]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/h264_ps.c
eatgv: return meaningful error codes.
[ffmpeg] / libavcodec / h264_ps.c
index 0166ad2e94d0cdea5a7de0ead2594b1c499a11ce..63f371c80c3969f7883eb41a79602fde68e210ed 100644 (file)
@@ -333,7 +333,11 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
     memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
     sps->scaling_matrix_present = 0;
 
-    if(sps->profile_idc >= 100){ //high profile
+    if (sps->profile_idc == 100 || sps->profile_idc == 110 ||
+        sps->profile_idc == 122 || sps->profile_idc == 244 ||
+        sps->profile_idc ==  44 || sps->profile_idc ==  83 ||
+        sps->profile_idc ==  86 || sps->profile_idc == 118 ||
+        sps->profile_idc == 128 || sps->profile_idc == 144) {
         sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
         if(sps->chroma_format_idc > 3) {
             av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
@@ -357,7 +361,7 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
         av_log(h->s.avctx, AV_LOG_ERROR,
                "log2_max_frame_num_minus4 out of range (0-12): %d\n",
                log2_max_frame_num_minus4);
-        return AVERROR_INVALIDDATA;
+        goto fail;
     }
     sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
 
@@ -421,6 +425,20 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){
         sps->crop_right = get_ue_golomb(&s->gb);
         sps->crop_top   = get_ue_golomb(&s->gb);
         sps->crop_bottom= get_ue_golomb(&s->gb);
+        if (h->s.avctx->flags2 & CODEC_FLAG2_IGNORE_CROP) {
+            av_log(h->s.avctx, AV_LOG_DEBUG,
+                   "discarding sps cropping, "
+                   "original values are l:%u r:%u t:%u b:%u\n",
+                   sps->crop_left,
+                   sps->crop_right,
+                   sps->crop_top,
+                   sps->crop_bottom);
+
+            sps->crop_left   =
+            sps->crop_right  =
+            sps->crop_top    =
+            sps->crop_bottom = 0;
+        }
         if(sps->crop_left || sps->crop_top){
             av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
         }