---
 libavcodec/h264_ps.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 54b735d..819b7ff 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -131,6 +131,9 @@ static inline int decode_hrd_parameters(H264Context *h, SPS 
*sps)
 static inline int decode_vui_parameters(H264Context *h, SPS *sps)
 {
     int aspect_ratio_info_present_flag;
+    int chroma_loc_info_present_flag;
+    int chroma_sample_loc_type_top_field;
+    int chroma_sample_loc_type_bottom_field;
     unsigned int aspect_ratio_idc;
 
     aspect_ratio_info_present_flag = get_bits1(&h->gb);
@@ -173,11 +176,12 @@ static inline int decode_vui_parameters(H264Context *h, 
SPS *sps)
         }
     }
 
-    /* chroma_location_info_present_flag */
-    if (get_bits1(&h->gb)) {
-        /* chroma_sample_location_type_top_field */
-        h->avctx->chroma_sample_location = get_ue_golomb(&h->gb) + 1;
-        get_ue_golomb(&h->gb);  /* chroma_sample_location_type_bottom_field */
+    chroma_loc_info_present_flag = get_bits1(&h->gb);
+    if (chroma_loc_info_present_flag) {
+        chroma_sample_loc_type_top_field    = get_ue_golomb(&h->gb);
+        chroma_sample_loc_type_bottom_field = get_ue_golomb(&h->gb);
+
+        h->avctx->chroma_sample_location = chroma_sample_loc_type_top_field + 
1;
     }
 
     sps->timing_info_present_flag = get_bits1(&h->gb);
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to