[vlc-commits] codec: hxxx_helper: add hxxx_helper_get_chroma_chroma

Thomas Guillem git at videolan.org
Thu Mar 1 10:28:46 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 26 10:02:13 2018 +0100| [0aa481c772668374ec24a4840b84ce25aa0df6c5] | committer: Thomas Guillem

codec: hxxx_helper: add hxxx_helper_get_chroma_chroma

(cherry picked from commit 999e487ed3ba51dd3234c27ee97ad9c287e8c0c9)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=0aa481c772668374ec24a4840b84ce25aa0df6c5
---

 modules/codec/hxxx_helper.c | 31 +++++++++++++++++++++++++++++++
 modules/codec/hxxx_helper.h |  4 ++++
 2 files changed, 35 insertions(+)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 1a04d0962c..26c6454abd 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -931,6 +931,37 @@ hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
 }
 
 int
+hxxx_helper_get_chroma_chroma(const struct hxxx_helper *hh, uint8_t *pi_chroma_format,
+                              uint8_t *pi_depth_luma, uint8_t *pi_depth_chroma)
+{
+    switch (hh->i_codec)
+    {
+        case VLC_CODEC_H264:
+        {
+            const struct hxxx_helper_nal *hsps = h264_helper_get_current_sps(hh);
+            if (hsps == NULL)
+                return VLC_EGENERIC;
+            return h264_get_chroma_luma(hsps->h264_sps, pi_chroma_format, pi_depth_luma,
+                                        pi_depth_chroma)
+                == true ? VLC_SUCCESS : VLC_EGENERIC;
+        }
+        case VLC_CODEC_HEVC:
+        {
+            const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
+            if (hsps == NULL || hsps->hevc_sps == NULL)
+                return VLC_EGENERIC;
+
+            return hevc_get_chroma_luma(hsps->hevc_sps, pi_chroma_format, pi_depth_luma,
+                                        pi_depth_chroma)
+                == true ? VLC_SUCCESS : VLC_EGENERIC;
+        }
+        default:
+            vlc_assert_unreachable();
+    }
+}
+
+
+int
 hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
                             video_color_primaries_t *p_primaries,
                             video_transfer_func_t *p_transfer,
diff --git a/modules/codec/hxxx_helper.h b/modules/codec/hxxx_helper.h
index ed5826d0b5..62fd0760e2 100644
--- a/modules/codec/hxxx_helper.h
+++ b/modules/codec/hxxx_helper.h
@@ -106,6 +106,10 @@ int h264_helper_get_current_dpb_values(const struct hxxx_helper *hh,
 int hxxx_helper_get_current_profile_level(const struct hxxx_helper *hh,
                                           uint8_t *p_profile, uint8_t *p_level);
 
+int
+hxxx_helper_get_chroma_chroma(const struct hxxx_helper *hh, uint8_t *pi_chroma_format,
+                              uint8_t *pi_depth_luma, uint8_t *pi_depth_chroma);
+
 int hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
                                 video_color_primaries_t *p_primaries,
                                 video_transfer_func_t *p_transfer,



More information about the vlc-commits mailing list