util/format: Add the P010 format used for 10-bit videos

Signed-off-by: Thong Thai <thong.thai@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>
This commit is contained in:
Thong Thai 2019-12-18 08:59:17 -05:00 committed by Marge Bot
parent 98885e9f61
commit ee8344bdcf
4 changed files with 44 additions and 0 deletions

View file

@ -385,6 +385,7 @@ PIPE_FORMAT_IYUV , planar3, 1, 1, 1, , , , , xy
PIPE_FORMAT_NV12 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_NV21 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_P010 , planar2, 1, 1, 1, , , , , xyzw, yuv
PIPE_FORMAT_P016 , planar2, 1, 1, 1, , , , , xyzw, yuv
# Usually used to implement IA44 and AI44 formats in video decoding

Can't render this file because it contains an unexpected character in line 8 and column 3.

View file

@ -1341,6 +1341,7 @@ util_format_get_plane_format(enum pipe_format format, unsigned plane)
return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_RG88_UNORM;
case PIPE_FORMAT_NV21:
return !plane ? PIPE_FORMAT_R8_UNORM : PIPE_FORMAT_GR88_UNORM;
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
return !plane ? PIPE_FORMAT_R16_UNORM : PIPE_FORMAT_R16G16_UNORM;
default:
@ -1358,6 +1359,7 @@ util_format_get_plane_width(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_IYUV:
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
return !plane ? width : (width + 1) / 2;
default:
@ -1374,6 +1376,7 @@ util_format_get_plane_height(enum pipe_format format, unsigned plane,
case PIPE_FORMAT_IYUV:
case PIPE_FORMAT_NV12:
case PIPE_FORMAT_NV21:
case PIPE_FORMAT_P010:
case PIPE_FORMAT_P016:
return !plane ? height : (height + 1) / 2;
case PIPE_FORMAT_YV16:

View file

@ -1016,6 +1016,25 @@ void
util_format_nv21_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
UNUSED unsigned i, UNUSED unsigned j) {}
void
util_format_p010_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
UNUSED unsigned width, UNUSED unsigned height) {}
void
util_format_p010_pack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
UNUSED unsigned width, UNUSED unsigned height) {}
void
util_format_p010_unpack_rgba_float(UNUSED float *dst_row, UNUSED unsigned dst_stride,
UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
UNUSED unsigned width, UNUSED unsigned height) {}
void
util_format_p010_pack_rgba_float(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
UNUSED const float *src_row, UNUSED unsigned src_stride,
UNUSED unsigned width, UNUSED unsigned height) {}
void
util_format_p010_fetch_rgba_float(UNUSED float *dst, UNUSED const uint8_t *src,
UNUSED unsigned i, UNUSED unsigned j) {}
void
util_format_p016_unpack_rgba_8unorm(UNUSED uint8_t *dst_row, UNUSED unsigned dst_stride,
UNUSED const uint8_t *src_row, UNUSED unsigned src_stride,
UNUSED unsigned width, UNUSED unsigned height) {}

View file

@ -265,6 +265,27 @@ util_format_nv21_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
void
util_format_nv21_fetch_rgba_float(float *dst, const uint8_t *src,
unsigned i, unsigned j);
void
util_format_p010_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
const uint8_t *src_row, unsigned src_stride,
unsigned width, unsigned height);
void
util_format_p010_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
const uint8_t *src_row, unsigned src_stride,
unsigned width, unsigned height);
void
util_format_p010_unpack_rgba_float(float *dst_row, unsigned dst_stride,
const uint8_t *src_row, unsigned src_stride,
unsigned width, unsigned height);
void
util_format_p010_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride,
const float *src_row, unsigned src_stride,
unsigned width, unsigned height);
void
util_format_p010_fetch_rgba_float(float *dst, const uint8_t *src,
unsigned i, unsigned j);
void
util_format_p016_unpack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
const uint8_t *src_row, unsigned src_stride,