@@ -1189,9 +1189,50 @@ namespace gem
11891189 }
11901190 case CELL_GEM_BAYER_RESTORED_RASTERIZED: // Restored Bayer output, R,G1,G2,B rearranged into 4 contiguous 320x240 1-channel rasters
11911191 {
1192- cellGem.error (" Unimplemented: Converting %s to %s (called from %s)" , input_format, output_format, caller);
1193- std::memcpy (video_data_out, video_data_in.data (), std::min<usz>(required_in_size, required_out_size));
1194- return false ;
1192+ if (input_format == CELL_CAMERA_RAW8)
1193+ {
1194+ const u32 dst_w = std::min (320u , width / 2 );
1195+ const u32 dst_h = std::min (240u , height / 2 );
1196+ const u32 in_pitch = width;
1197+ constexpr u32 out_plane = 320 * 240 ;
1198+ constexpr u32 out_pitch = 320 ;
1199+
1200+ u8 * dst_plane_r = video_data_out;
1201+ u8 * dst_plane_g1 = video_data_out + out_plane;
1202+ u8 * dst_plane_g2 = video_data_out + out_plane * 2 ;
1203+ u8 * dst_plane_b = video_data_out + out_plane * 3 ;
1204+
1205+ for (u32 y = 0 ; y < dst_h; y++)
1206+ {
1207+ const u8 * src0 = &video_data_in[y * 2 * in_pitch];
1208+ const u8 * src1 = src0 + in_pitch;
1209+
1210+ u8 * dst_r = dst_plane_r + y * out_pitch;
1211+ u8 * dst_g1 = dst_plane_g1 + y * out_pitch;
1212+ u8 * dst_g2 = dst_plane_g2 + y * out_pitch;
1213+ u8 * dst_b = dst_plane_b + y * out_pitch;
1214+
1215+ for (u32 x = 0 ; x < dst_w; x++, src0 += 2 , src1 += 2 )
1216+ {
1217+ const u8 b = src0[0 ];
1218+ const u8 g0 = src0[1 ];
1219+ const u8 g1 = src1[0 ];
1220+ const u8 r = src1[1 ];
1221+
1222+ dst_r[x] = r;
1223+ dst_g1[x] = g0;
1224+ dst_g2[x] = g1;
1225+ dst_b[x] = b;
1226+ }
1227+ }
1228+ }
1229+ else
1230+ {
1231+ cellGem.error (" Unimplemented: Converting %s to %s (called from %s)" , input_format, output_format, caller);
1232+ std::memcpy (video_data_out, video_data_in.data (), std::min<usz>(required_in_size, required_out_size));
1233+ return false ;
1234+ }
1235+ break ;
11951236 }
11961237 case CELL_GEM_NO_VIDEO_OUTPUT: // Disable video output
11971238 {
0 commit comments