[FFmpeg-cvslog] H264: set colorspace and full range to values indicating unspecified by default

Michael Niedermayer git at videolan.org
Sat Oct 8 03:25:26 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Oct  8 01:12:46 2011 +0200| [74f77eb048913ad764537f79fd954d2db3f7fd55] | committer: Michael Niedermayer

H264: set colorspace and full range to values indicating unspecified by default
Code based on ffdshow
Author unknown

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74f77eb048913ad764537f79fd954d2db3f7fd55
---

 libavcodec/h264.c    |    2 +-
 libavcodec/h264_ps.c |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index cb2ce98..40da076 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2670,7 +2670,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
         }
 
         if(h->sps.video_signal_type_present_flag){
-            s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+            s->avctx->color_range = h->sps.full_range>0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
             if(h->sps.colour_description_present_flag){
                 s->avctx->color_primaries = h->sps.color_primaries;
                 s->avctx->color_trc       = h->sps.color_trc;
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c
index 637cf27..f0ec0ff 100644
--- a/libavcodec/h264_ps.c
+++ b/libavcodec/h264_ps.c
@@ -338,10 +338,12 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
     sps->profile_idc= profile_idc;
     sps->constraint_set_flags = constraint_set_flags;
     sps->level_idc= level_idc;
+    sps->full_range = -1;
 
     memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
     memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
     sps->scaling_matrix_present = 0;
+    sps->colorspace = 2; //AVCOL_SPC_UNSPECIFIED
 
     if(sps->profile_idc >= 100){ //high profile
         sps->chroma_format_idc= get_ue_golomb_31(&s->gb);



More information about the ffmpeg-cvslog mailing list