-
Notifications
You must be signed in to change notification settings - Fork 1
/
meta.go
194 lines (158 loc) · 6.27 KB
/
meta.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package rkcodec
//#include <rockchip/mpp_meta.h>
//#include <rockchip/rk_type.h>
import "C"
import "unsafe"
type MppMetaType = cU32
const (
MetaTypeFrame = MppMetaType(C.TYPE_FRAME)
MetaTypePacket = MppMetaType(C.TYPE_PACKET)
MetaTypeBuffer = MppMetaType(C.TYPE_BUFFER)
MetaTypeS32 = MppMetaType(C.TYPE_S32)
MetaTypeS64 = MppMetaType(C.TYPE_S64)
MetaTypePtr = MppMetaType(C.TYPE_PTR)
)
type MppMetaKey = C.MppMetaKey
const (
// data flow key
MetaKeyInputFrame = MppMetaKey(C.KEY_INPUT_FRAME)
MetaKeyInputPacket = MppMetaKey(C.KEY_INPUT_PACKET)
MetaKeyOutputFrame = MppMetaKey(C.KEY_OUTPUT_FRAME)
MetaKeyOutputPacket = MppMetaKey(C.KEY_OUTPUT_PACKET)
// output motion information for motion detection
MetaKeyMotionInfo = MppMetaKey(C.KEY_MOTION_INFO)
MetaKeyHdrInfo = MppMetaKey(C.KEY_HDR_INFO)
MetaKeyHdrMetaOffset = MppMetaKey(C.KEY_HDR_META_OFFSET)
MetaKeyHdrMetaSize = MppMetaKey(C.KEY_HDR_META_SIZE)
// flow control key
MetaKeyInputBlock = MppMetaKey(C.KEY_INPUT_BLOCK)
MetaKeyOutputBlock = MppMetaKey(C.KEY_OUTPUT_BLOCK)
MetaKeyInputIdrReq = MppMetaKey(C.KEY_INPUT_IDR_REQ) // input idr frame request flag
MetaKeyOutputIntra = MppMetaKey(C.KEY_OUTPUT_INTRA) // output intra frame indicator
// mpp_frame / mpp_packet meta data info key
MetaKeyTemporalId = MppMetaKey(C.KEY_TEMPORAL_ID)
MetaKeyLongRefIdx = MppMetaKey(C.KEY_LONG_REF_IDX)
MetaKeyEncAverageQp = MppMetaKey(C.KEY_ENC_AVERAGE_QP)
MetaKeyEncStartQp = MppMetaKey(C.KEY_ENC_START_QP)
MetaKeyRoiData = MppMetaKey(C.KEY_ROI_DATA)
MetaKeyOsdData = MppMetaKey(C.KEY_OSD_DATA)
MetaKeyOsdData2 = MppMetaKey(C.KEY_OSD_DATA2)
MetaKeyUserData = MppMetaKey(C.KEY_USER_DATA)
MetaKeyUserDatas = MppMetaKey(C.KEY_USER_DATAS)
// num of inter different size predicted block
MetaKeyLvl64InterNum = MppMetaKey(C.KEY_LVL64_INTER_NUM)
MetaKeyLvl32InterNum = MppMetaKey(C.KEY_LVL32_INTER_NUM)
MetaKeyLvl16InterNum = MppMetaKey(C.KEY_LVL16_INTER_NUM)
MetaKeyLvl8InterNum = MppMetaKey(C.KEY_LVL8_INTER_NUM)
// num of intra different size predicted block
MetaKeyLvl32IntraNum = MppMetaKey(C.KEY_LVL32_INTRA_NUM)
MetaKeyLvl16IntraNum = MppMetaKey(C.KEY_LVL16_INTRA_NUM)
MetaKeyLvl8IntraNum = MppMetaKey(C.KEY_LVL8_INTRA_NUM)
MetaKeyLvl4IntraNum = MppMetaKey(C.KEY_LVL4_INTRA_NUM)
// output P skip frame indicator
MetaKeyOutputPskip = MppMetaKey(C.KEY_OUTPUT_PSKIP)
MetaKeyEncSse = MppMetaKey(C.KEY_ENC_SSE)
// For vepu580 roi buffer config mode
MetaKeyRoiData2 = MppMetaKey(C.KEY_ROI_DATA2)
// qpmap for rv1109/1126 encoder qpmap config
MetaKeyQpmap0 = MppMetaKey(C.KEY_QPMAP0)
// input motion list for smart p rate control
MetaKeyMvList = MppMetaKey(C.KEY_MV_LIST)
// frame long-term reference frame operation
MetaKeyEncMarkLtr = MppMetaKey(C.KEY_ENC_MARK_LTR)
MetaKeyEncUseLtr = MppMetaKey(C.KEY_ENC_USE_LTR)
// MLVEC specified encoder feature
MetaKeyEncFrameQp = MppMetaKey(C.KEY_ENC_FRAME_QP)
MetaKeyEncBaseLayerPid = MppMetaKey(C.KEY_ENC_BASE_LAYER_PID)
// Thumbnail info for decoder output frame
MetaKeyDecTbnEn = MppMetaKey(C.KEY_DEC_TBN_EN)
MetaKeyDecTbnYOffset = MppMetaKey(C.KEY_DEC_TBN_Y_OFFSET)
MetaKeyDecTbnUvOffset = MppMetaKey(C.KEY_DEC_TBN_UV_OFFSET)
)
func (m *MppMeta) GetWithTag(tag string, caller string) MppRet {
return MppRet(C.mpp_meta_get_with_tag(&m.c, C.CString(tag), C.CString(caller)))
}
func (m *MppMeta) Put() MppRet {
return MppRet(C.mpp_meta_put(m.c))
}
func (m *MppMeta) Size() int32 {
return int32(C.mpp_meta_size(m.c))
}
func (m *MppMeta) SetS32(key MppMetaKey, val int32) MppRet {
return MppRet(C.mpp_meta_set_s32(m.c, key, C.RK_S32(val)))
}
func (m *MppMeta) SetS64(key MppMetaKey, val int64) MppRet {
return MppRet(C.mpp_meta_set_s64(m.c, key, C.RK_S64(val)))
}
func (m *MppMeta) SetPtr(key MppMetaKey, val unsafe.Pointer) MppRet {
return MppRet(C.mpp_meta_set_ptr(m.c, key, val))
}
func (m *MppMeta) GetS32(key MppMetaKey) (int32, MppRet) {
var val C.RK_S32
ret := MppRet(C.mpp_meta_get_s32(m.c, key, &val))
return int32(val), ret
}
func (m *MppMeta) GetS64(key MppMetaKey) (int64, MppRet) {
var val C.RK_S64
ret := MppRet(C.mpp_meta_get_s64(m.c, key, &val))
return int64(val), ret
}
func (m *MppMeta) GetPtr(key MppMetaKey) (unsafe.Pointer, MppRet) {
var val unsafe.Pointer
ret := MppRet(C.mpp_meta_get_ptr(m.c, key, &val))
return val, ret
}
func (m *MppMeta) SetFrame(key MppMetaKey, frame MppFrame) MppRet {
return MppRet(C.mpp_meta_set_frame(m.c, key, *frame.c))
}
func (m *MppMeta) SetPacket(key MppMetaKey, packet MppPacket) MppRet {
return MppRet(C.mpp_meta_set_packet(m.c, key, *packet.c))
}
func (m *MppMeta) SetBuffer(key MppMetaKey, buffer MppBuffer) MppRet {
return MppRet(C.mpp_meta_set_buffer(m.c, key, buffer.c))
}
func (m *MppMeta) GetFrame(key MppMetaKey) (MppFrame, MppRet) {
var frame MppFrame
ret := MppRet(C.mpp_meta_get_frame(m.c, key, frame.c))
return frame, ret
}
func (m *MppMeta) GetPacket(key MppMetaKey) (MppPacket, MppRet) {
var packet MppPacket
ret := MppRet(C.mpp_meta_get_packet(m.c, key, packet.c))
return packet, ret
}
func (m *MppMeta) GetBuffer(key MppMetaKey) (MppBuffer, MppRet) {
var buffer MppBuffer
ret := MppRet(C.mpp_meta_get_buffer(m.c, key, &buffer.c))
return buffer, ret
}
func (m *MppMeta) GetS32D(key MppMetaKey, def int32) (int32, MppRet) {
var val C.RK_S32
ret := MppRet(C.mpp_meta_get_s32_d(m.c, key, &val, C.RK_S32(def)))
return int32(val), ret
}
func (m *MppMeta) GetS64D(key MppMetaKey, def int64) (int64, MppRet) {
var val C.RK_S64
ret := MppRet(C.mpp_meta_get_s64_d(m.c, key, &val, C.RK_S64(def)))
return int64(val), ret
}
func (m *MppMeta) GetPtrD(key MppMetaKey, def unsafe.Pointer) (unsafe.Pointer, MppRet) {
var val unsafe.Pointer
ret := MppRet(C.mpp_meta_get_ptr_d(m.c, key, &val, def))
return val, ret
}
func (m *MppMeta) GetFrameD(key MppMetaKey, def MppFrame) (MppFrame, MppRet) {
var frame MppFrame
ret := MppRet(C.mpp_meta_get_frame_d(m.c, key, frame.c, *def.c))
return frame, ret
}
func (m *MppMeta) GetPacketD(key MppMetaKey, def MppPacket) (MppPacket, MppRet) {
var packet MppPacket
ret := MppRet(C.mpp_meta_get_packet_d(m.c, key, packet.c, *def.c))
return packet, ret
}
func (m *MppMeta) GetBufferD(key MppMetaKey, def MppBuffer) (MppBuffer, MppRet) {
var buffer MppBuffer
ret := MppRet(C.mpp_meta_get_buffer_d(m.c, key, &buffer.c, def.c))
return buffer, ret
}