cellCamera: fix buffer size for YUV

This commit is contained in:
Megamouse 2021-10-17 19:16:07 +02:00
parent 81c216f330
commit bf71b1fcf7
1 changed files with 8 additions and 4 deletions

View File

@ -264,24 +264,28 @@ u32 get_video_buffer_size(const CellCameraInfoEx& info)
u32 width, height; u32 width, height;
std::tie(width, height) = get_video_resolution(info); std::tie(width, height) = get_video_resolution(info);
u32 bytes_per_pixel; double bytes_per_pixel;
switch (info.format) switch (info.format)
{ {
case CELL_CAMERA_RAW8: case CELL_CAMERA_RAW8:
bytes_per_pixel = 1; bytes_per_pixel = 1.0;
break; break;
case CELL_CAMERA_YUV422: case CELL_CAMERA_YUV422:
bytes_per_pixel = 2.0;
break;
case CELL_CAMERA_YUV420: case CELL_CAMERA_YUV420:
case CELL_CAMERA_V_Y1_U_Y0: case CELL_CAMERA_V_Y1_U_Y0:
bytes_per_pixel = 1.5;
break;
case CELL_CAMERA_RAW10: case CELL_CAMERA_RAW10:
bytes_per_pixel = 2; bytes_per_pixel = 1.25;
break; break;
case CELL_CAMERA_JPG: case CELL_CAMERA_JPG:
case CELL_CAMERA_RGBA: case CELL_CAMERA_RGBA:
case CELL_CAMERA_FORMAT_UNKNOWN: case CELL_CAMERA_FORMAT_UNKNOWN:
default: default:
bytes_per_pixel = 4; bytes_per_pixel = 4.0;
break; break;
} }