aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-02-05 10:20:06 +0100
committerPierre-Eric Pelloux-Prayer <[email protected]>2020-02-27 10:01:31 +0100
commit87807298a307d4e38195dc04f66c26404e7cb791 (patch)
treeb4a388874f23cb9c553e14b6d0fb4c60649c82ee /src
parentfb29f0847f87504f8162ebe7b9324244387ff501 (diff)
format: add format_to_chroma_format
Reviewed-by: Marek Olšák <[email protected]> Acked-by: Leo Liu <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3738>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/include/pipe/p_format.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h
index 46bb8c97a00..a51843caa20 100644
--- a/src/gallium/include/pipe/p_format.h
+++ b/src/gallium/include/pipe/p_format.h
@@ -560,6 +560,26 @@ enum pipe_video_chroma_format
PIPE_VIDEO_CHROMA_FORMAT_NONE
};
+static inline enum pipe_video_chroma_format
+pipe_format_to_chroma_format(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_NV12:
+ case PIPE_FORMAT_NV21:
+ case PIPE_FORMAT_YV12:
+ case PIPE_FORMAT_IYUV:
+ case PIPE_FORMAT_P010:
+ case PIPE_FORMAT_P016:
+ return PIPE_VIDEO_CHROMA_FORMAT_420;
+ case PIPE_FORMAT_UYVY:
+ case PIPE_FORMAT_YUYV:
+ case PIPE_FORMAT_YV16:
+ return PIPE_VIDEO_CHROMA_FORMAT_422;
+ default:
+ return PIPE_VIDEO_CHROMA_FORMAT_NONE;
+ }
+}
+
#ifdef __cplusplus
}
#endif