util/format: Add the P010 format used for 10-bit videos
authorThong Thai <thong.thai@amd.com>
Wed, 18 Dec 2019 13:59:17 +0000 (08:59 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 3 Jan 2020 16:30:22 +0000 (16:30 +0000)
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>

src/util/format/u_format.csv
src/util/format/u_format.h
src/util/format/u_format_yuv.c
src/util/format/u_format_yuv.h

index 4bc9e4b83aa2e5e5a66408a1fdbeba51622ae9fa..17c3566ec3e9e74850e4d81c940ba66f29a7576d 100644 (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
index a0eac087bf52be39208c97107a68d2dccb44d37d..796373c3f67f99e00dd96798c24fe764816fcca5 100644 (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:
index 7ce77f21b24d42a9ded73b41714ad4401d4e0762..ae088f4397871b7072341938fb343e90f777a33f 100644 (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) {}
index 0acb1747e43a78f63483c7c7309889265a5f4e4b..3c822bcb148856fdedbf7728b18517f4e2e236e5 100644 (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,