aux/util: Add more formats

This commit is contained in:
Jakob Bornecrantz 2019-08-04 20:23:00 +01:00
parent 36f24036eb
commit fc88d7d099

View file

@ -19,6 +19,9 @@ u_format_str(enum xrt_format f)
case XRT_FORMAT_R8G8B8X8: return "XRT_FORMAT_R8G8B8X8";
case XRT_FORMAT_R8G8B8A8: return "XRT_FORMAT_R8G8B8A8";
case XRT_FORMAT_R8G8B8: return "XRT_FORMAT_R8G8B8";
case XRT_FORMAT_R8G8: return "XRT_FORMAT_R8G8";
case XRT_FORMAT_R8: return "XRT_FORMAT_R8";
case XRT_FORMAT_L8: return "XRT_FORMAT_L8";
case XRT_FORMAT_BITMAP_8X1: return "XRT_FORMAT_BITMAP_8X1";
case XRT_FORMAT_BITMAP_8X8: return "XRT_FORMAT_BITMAP_8X8";
case XRT_FORMAT_YUV888: return "XRT_FORMAT_YUV888";
@ -35,6 +38,9 @@ u_format_is_blocks(enum xrt_format f)
case XRT_FORMAT_R8G8B8X8:
case XRT_FORMAT_R8G8B8A8:
case XRT_FORMAT_R8G8B8:
case XRT_FORMAT_R8G8:
case XRT_FORMAT_R8:
case XRT_FORMAT_L8:
case XRT_FORMAT_BITMAP_8X1:
case XRT_FORMAT_BITMAP_8X8:
case XRT_FORMAT_YUV888:
@ -55,6 +61,9 @@ u_format_block_width(enum xrt_format f)
case XRT_FORMAT_R8G8B8X8:
case XRT_FORMAT_R8G8B8A8:
case XRT_FORMAT_R8G8B8:
case XRT_FORMAT_R8G8:
case XRT_FORMAT_R8:
case XRT_FORMAT_L8:
case XRT_FORMAT_YUV888:
// Regular one pixel per block formats.
return 1;
@ -76,6 +85,9 @@ u_format_block_height(enum xrt_format f)
case XRT_FORMAT_R8G8B8X8:
case XRT_FORMAT_R8G8B8A8:
case XRT_FORMAT_R8G8B8:
case XRT_FORMAT_R8G8:
case XRT_FORMAT_R8:
case XRT_FORMAT_L8:
case XRT_FORMAT_BITMAP_8X1:
case XRT_FORMAT_YUV888:
case XRT_FORMAT_YUV422:
@ -92,8 +104,14 @@ size_t
u_format_block_size(enum xrt_format f)
{
switch (f) {
case XRT_FORMAT_BITMAP_8X1: return 1;
case XRT_FORMAT_BITMAP_8X1:
case XRT_FORMAT_R8:
case XRT_FORMAT_L8:
// One byte blocks
return 1;
case XRT_FORMAT_R8G8:
// Two bytes, 16bits.
return 2;
case XRT_FORMAT_R8G8B8:
case XRT_FORMAT_YUV888:
// Weird 24bit pixel formats.