]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/hevc: export chroma sample location
authorHendrik Leppkes <h.leppkes@gmail.com>
Wed, 11 Apr 2018 11:46:10 +0000 (13:46 +0200)
committerHendrik Leppkes <h.leppkes@gmail.com>
Wed, 24 Jun 2020 10:02:13 +0000 (12:02 +0200)
libavcodec/hevcdec.c

index c9e28f5826a9e7aa3fbcfae342e0748b837e1c08..b63cba6c25e49d0ea6f32978e93cde7950e54342 100644 (file)
@@ -348,6 +348,15 @@ static void export_stream_params(HEVCContext *s, const HEVCSPS *sps)
         avctx->colorspace      = AVCOL_SPC_UNSPECIFIED;
     }
 
+    avctx->chroma_sample_location = AVCHROMA_LOC_UNSPECIFIED;
+    if (sps->chroma_format_idc == 1) {
+        if (sps->vui.chroma_loc_info_present_flag) {
+            if (sps->vui.chroma_sample_loc_type_top_field <= 5)
+                avctx->chroma_sample_location = sps->vui.chroma_sample_loc_type_top_field + 1;
+        } else
+            avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
+    }
+
     if (vps->vps_timing_info_present_flag) {
         num = vps->vps_num_units_in_tick;
         den = vps->vps_time_scale;