aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/format
diff options
context:
space:
mode:
authorThong Thai <[email protected]>2019-12-18 08:59:17 -0500
committerMarge Bot <[email protected]>2020-01-03 16:30:22 +0000
commitee8344bdcffe7035daa775344c0797d19cc60648 (patch)
tree1a75080fb67da84aacdbd10cf86f43a96cbe3f41 /src/util/format
parent98885e9f6164e1c9b764c8e237ed6c996c2305cb (diff)
util/format: Add the P010 format used for 10-bit videos
Signed-off-by: Thong Thai <[email protected]> Reviewed-by: Leo Liu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>
Diffstat (limited to 'src/util/format')
-rw-r--r--src/util/format/u_format.csv1
-rw-r--r--src/util/format/u_format.h3
-rw-r--r--src/util/format/u_format_yuv.c19
-rw-r--r--src/util/format/u_format_yuv.h21
4 files changed, 44 insertions, 0 deletions
diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
index 4bc9e4b83aa..17c3566ec3e 100644
--- a/src/util/format/u_format.csv
+++ b/src/util/format/u_format.csv
@@ -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
diff --git a/src/util/format/u_format.h b/src/util/format/u_format.h
index a0eac087bf5..796373c3f67 100644
--- a/src/util/format/u_format.h
+++ b/src/util/format/u_format.h
@@ -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:
diff --git a/src/util/format/u_format_yuv.c b/src/util/format/u_format_yuv.c
index 7ce77f21b24..ae088f43978 100644
--- a/src/util/format/u_format_yuv.c
+++ b/src/util/format/u_format_yuv.c
@@ -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) {}
diff --git a/src/util/format/u_format_yuv.h b/src/util/format/u_format_yuv.h
index 0acb1747e43..3c822bcb148 100644
--- a/src/util/format/u_format_yuv.h
+++ b/src/util/format/u_format_yuv.h
@@ -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,