Skip to content

Commit b6d1875

Browse files
HuHengjonahmvp
authored andcommitted
support yuv yuva 8/10/12/16 bit format
1 parent 5584909 commit b6d1875

File tree

2 files changed

+89
-18
lines changed

2 files changed

+89
-18
lines changed

bmf/hmp/include/hmp/imgproc/formats.h

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ enum ColorRange { CR_UNSPECIFIED = 0, CR_MPEG = 1, CR_JPEG = 2, CR_NB };
109109

110110
enum PixelFormat {
111111
PF_NONE = -1,
112-
PF_YUV420P = 0,
113-
PF_YUV422P = 4,
114-
PF_YUV444P = 5,
115112
PF_NV12 = 23,
116113
PF_NV21 = 24,
117114

@@ -127,29 +124,56 @@ enum PixelFormat {
127124
PF_BGRA32 = 28,
128125

129126
PF_GRAY16 = 30,
130-
PF_YUVA420P = 33,
131127
PF_RGB48 = 35,
132128
PF_YA8 = 58,
133129
PF_BGR48 = 61,
134130
PF_RGBA64 = 107,
135131

136132
PF_P010LE = 161,
137133
PF_P016LE = 172,
138-
PF_YUV422P10LE = 66,
139-
PF_YUV420P10LE = 64,
140-
PF_YUV444P10LE = 68,
141134

142-
PF_YUVA422P = 80,
143-
PF_YUVA444P = 81,
144135

145136
PF_NV16 = 103,
146137
PF_NV24 = 191,
138+
139+
//8bit
140+
PF_YUV420P = 0,
141+
PF_YUV422P = 4,
142+
PF_YUV444P = 5,
143+
144+
PF_YUVA420P = 33,
145+
PF_YUVA422P = 80,
146+
PF_YUVA444P = 81,
147+
148+
//10bit
149+
PF_YUV422P10LE = 66,
150+
PF_YUV420P10LE = 64,
151+
PF_YUV444P10LE = 70,
152+
153+
PF_YUVA422P10LE = 91,
154+
PF_YUVA420P10LE = 89,
155+
PF_YUVA444P10LE = 93,
156+
157+
//12bit
158+
PF_YUV420P12LE = 125,
159+
PF_YUV422P12LE = 129,
160+
PF_YUV444P12LE = 133,
161+
162+
PF_YUVA422P12LE = 188,
163+
PF_YUVA444P12LE = 190,
164+
165+
//16bit
166+
PF_YUV420P16LE = 47,
167+
PF_YUV422P16LE = 49,
168+
PF_YUV444P16LE = 51,
169+
170+
PF_YUVA420P16LE = 95,
171+
PF_YUVA422P16LE = 97,
172+
PF_YUVA444P16LE = 99,
173+
147174
};
148175

149176
#define HMP_FORALL_PIXEL_FORMATS(_) \
150-
_(PF_YUV420P) \
151-
_(PF_YUV422P) \
152-
_(PF_YUV444P) \
153177
_(PF_NV12) \
154178
_(PF_NV21) \
155179
_(PF_GRAY8) \
@@ -158,18 +182,36 @@ enum PixelFormat {
158182
_(PF_RGBA32) \
159183
_(PF_BGRA32) \
160184
_(PF_GRAY16) \
161-
_(PF_YUVA420P) \
162185
_(PF_RGB48) \
163186
_(PF_YA8) \
164187
_(PF_RGBA64) \
165188
_(PF_P010LE) \
166189
_(PF_P016LE) \
167-
_(PF_YUV422P10LE) \
168-
_(PF_YUV420P10LE) \
190+
_(PF_NV16) \
191+
_(PF_NV24) \
192+
_(PF_YUV420P) \
193+
_(PF_YUV422P) \
194+
_(PF_YUV444P) \
195+
_(PF_YUVA420P) \
169196
_(PF_YUVA422P) \
170197
_(PF_YUVA444P) \
171-
_(PF_NV16) \
172-
_(PF_NV24)
198+
_(PF_YUV422P10LE) \
199+
_(PF_YUV420P10LE) \
200+
_(PF_YUV444P10LE) \
201+
_(PF_YUVA422P10LE) \
202+
_(PF_YUVA420P10LE) \
203+
_(PF_YUVA444P10LE) \
204+
_(PF_YUV420P12LE) \
205+
_(PF_YUV422P12LE) \
206+
_(PF_YUV444P12LE) \
207+
_(PF_YUVA422P12LE) \
208+
_(PF_YUVA444P12LE) \
209+
_(PF_YUV420P16LE) \
210+
_(PF_YUV422P16LE) \
211+
_(PF_YUV444P16LE) \
212+
_(PF_YUVA420P16LE) \
213+
_(PF_YUVA422P16LE) \
214+
_(PF_YUVA444P16LE)
173215

174216
HMP_API std::string stringfy(const PixelFormat &format);
175217
PixelFormat HMP_API get_pixel_format(std::string pixfmt);

bmf/hmp/src/imgproc/formats.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,24 @@ static PixelFormatDesc::Private sPixelFormatMetas[]{
195195
PixelFormat::PF_YUV422P10LE, kUInt16, 3, {0x111, 0x121, 0x121, 0x0}},
196196
PixelFormatDesc::Private{
197197
PixelFormat::PF_YUV420P10LE, kUInt16, 3, {0x111, 0x221, 0x221, 0x0}},
198-
198+
PixelFormatDesc::Private{
199+
PixelFormat::PF_YUV444P10LE, kUInt16, 3, {0x111, 0x111, 0x111, 0x0}},
200+
PixelFormatDesc::Private{
201+
PixelFormat::PF_YUVA422P10LE, kUInt16, 4, {0x111, 0x121, 0x121, 0x111}},
202+
PixelFormatDesc::Private{
203+
PixelFormat::PF_YUVA420P10LE, kUInt16, 4, {0x111, 0x221, 0x221, 0x111}},
204+
PixelFormatDesc::Private{
205+
PixelFormat::PF_YUVA444P10LE, kUInt16, 4, {0x111, 0x111, 0x111, 0x111}},
206+
PixelFormatDesc::Private{
207+
PixelFormat::PF_YUV422P12LE, kUInt16, 3, {0x111, 0x121, 0x121, 0x0}},
208+
PixelFormatDesc::Private{
209+
PixelFormat::PF_YUV420P12LE, kUInt16, 3, {0x111, 0x221, 0x221, 0x0}},
210+
PixelFormatDesc::Private{
211+
PixelFormat::PF_YUV444P12LE, kUInt16, 3, {0x111, 0x111, 0x111, 0x0}},
212+
PixelFormatDesc::Private{
213+
PixelFormat::PF_YUVA422P12LE, kUInt16, 4, {0x111, 0x121, 0x121, 0x111}},
214+
PixelFormatDesc::Private{
215+
PixelFormat::PF_YUVA444P12LE, kUInt16, 4, {0x111, 0x111, 0x111, 0x111}},
199216
PixelFormatDesc::Private{
200217
PixelFormat::PF_GRAY8, kUInt8, 1, {0x111, 0x00, 0x00, 0x0}}, //
201218
PixelFormatDesc::Private{
@@ -206,6 +223,18 @@ static PixelFormatDesc::Private sPixelFormatMetas[]{
206223
PixelFormat::PF_RGB24, kUInt8, 1, {0x113, 0x00, 0x00, 0x0}}, //
207224
PixelFormatDesc::Private{
208225
PixelFormat::PF_BGR24, kUInt8, 1, {0x113, 0x00, 0x00, 0x0}}, //
226+
PixelFormatDesc::Private{
227+
PixelFormat::PF_YUV422P16LE, kUInt16, 3, {0x111, 0x121, 0x121, 0x0}},
228+
PixelFormatDesc::Private{
229+
PixelFormat::PF_YUV420P16LE, kUInt16, 3, {0x111, 0x221, 0x221, 0x0}},
230+
PixelFormatDesc::Private{
231+
PixelFormat::PF_YUV444P16LE, kUInt16, 3, {0x111, 0x111, 0x111, 0x0}},
232+
PixelFormatDesc::Private{
233+
PixelFormat::PF_YUVA422P16LE, kUInt16, 4, {0x111, 0x121, 0x121, 0x111}},
234+
PixelFormatDesc::Private{
235+
PixelFormat::PF_YUVA420P16LE, kUInt16, 4, {0x111, 0x221, 0x221, 0x111}},
236+
PixelFormatDesc::Private{
237+
PixelFormat::PF_YUVA444P16LE, kUInt16, 4, {0x111, 0x111, 0x111, 0x111}},
209238
PixelFormatDesc::Private{
210239
PixelFormat::PF_RGB48, kUInt16, 1, {0x113, 0x00, 0x00, 0x0}}, //
211240
PixelFormatDesc::Private{

0 commit comments

Comments
 (0)