Mesa (master): util/format: Add the P010 format used for 10-bit videos

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 3 16:49:15 UTC 2020


Module: Mesa
Branch: master
Commit: ee8344bdcffe7035daa775344c0797d19cc60648
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee8344bdcffe7035daa775344c0797d19cc60648

Author: Thong Thai <thong.thai at amd.com>
Date:   Wed Dec 18 08:59:17 2019 -0500

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

Signed-off-by: Thong Thai <thong.thai at amd.com>
Reviewed-by: Leo Liu <leo.liu at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3153>

---

 src/util/format/u_format.csv   |  1 +
 src/util/format/u_format.h     |  3 +++
 src/util/format/u_format_yuv.c | 19 +++++++++++++++++++
 src/util/format/u_format_yuv.h | 21 +++++++++++++++++++++
 4 files changed, 44 insertions(+)

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,




More information about the mesa-commit mailing list