@@ -65,6 +65,18 @@ void write_rgb888(std::ofstream &out, std::array<uint8_t *, 3> &mem, unsigned in
6565 write_plane (out, (uint8_t *)mem[0 ], width * 3 , height, file_stride, buffer_stride);
6666}
6767
68+ void read_32 (std::array<uint8_t *, 3 > &mem, std::ifstream &in, unsigned int width, unsigned int height,
69+ unsigned int file_stride, unsigned int buffer_stride)
70+ {
71+ read_plane ((uint8_t *)mem[0 ], in, width * 4 , height, file_stride, buffer_stride);
72+ }
73+
74+ void write_32 (std::ofstream &out, std::array<uint8_t *, 3 > &mem, unsigned int width, unsigned int height,
75+ unsigned int file_stride, unsigned int buffer_stride)
76+ {
77+ write_plane (out, (uint8_t *)mem[0 ], width * 4 , height, file_stride, buffer_stride);
78+ }
79+
6880void read_yuv (std::array<uint8_t *, 3 > &mem, std::ifstream &in, unsigned int width, unsigned int height,
6981 unsigned int file_stride, unsigned int buffer_stride, unsigned int ss_x, unsigned int ss_y)
7082{
@@ -152,6 +164,7 @@ struct FormatFuncs
152164const std::map<std::string, FormatFuncs> Formats =
153165{
154166 { " RGB888" , { read_rgb888, write_rgb888 } },
167+ { " RGBX8888" , { read_32, write_32 } },
155168 { " YUV420P" , { read_yuv420, write_yuv420 } },
156169 { " YUV422P" , { read_yuv422p, write_yuv422p } },
157170 { " YUV444P" , { read_yuv444p, write_yuv444p } },
@@ -280,6 +293,11 @@ int main(int argc, char *argv[])
280293 global.bayer_enables = 0 ;
281294 global.rgb_enables = PISP_BE_RGB_ENABLE_INPUT + PISP_BE_RGB_ENABLE_OUTPUT0;
282295
296+ if ((in_file.format == " RGBX8888" || out_file.format == " RGBX8888" ) && !variant->BackendRGB32Supported (0 ))
297+ {
298+ std::cerr << " Backend hardware does not support RGBX formats" << std::endl;
299+ exit (-1 );
300+ }
283301 pisp_image_format_config i = {};
284302 i.width = in_file.width ;
285303 i.height = in_file.height ;
@@ -299,20 +317,20 @@ int main(int argc, char *argv[])
299317 if (!out_file.stride )
300318 out_file.stride = o.image .stride ;
301319
302- if (in_file.format ! = " RGB888 " )
320+ if (in_file.format > = " U " )
303321 {
304322 pisp_be_ccm_config csc;
305323 be.InitialiseYcbcrInverse (csc, " jpeg" );
306324 be.SetCcm (csc);
307- global.rgb_enables + = PISP_BE_RGB_ENABLE_CCM;
325+ global.rgb_enables | = PISP_BE_RGB_ENABLE_CCM;
308326 }
309327
310- if (out_file.format ! = " RGB888 " )
328+ if (out_file.format > = " U " )
311329 {
312330 pisp_be_ccm_config csc;
313331 be.InitialiseYcbcr (csc, " jpeg" );
314332 be.SetCsc (0 , csc);
315- global.rgb_enables + = PISP_BE_RGB_ENABLE_CSC0;
333+ global.rgb_enables | = PISP_BE_RGB_ENABLE_CSC0;
316334 }
317335
318336 be.SetGlobal (global);
0 commit comments