Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

xvba: backport Check on faulty Level41 files

  • Loading branch information...
commit c3ea86a0de5ffd440ca9f3651409bed8ebef1e98 1 parent c633159
Peter Frühberger authored July 17, 2012

Showing 1 changed file with 11 additions and 0 deletions. Show diff stats Hide diff stats

  1. 11  lib/ffmpeg/libavcodec/xvba_h264.c
11  lib/ffmpeg/libavcodec/xvba_h264.c
@@ -101,6 +101,17 @@ static int end_frame(AVCodecContext *avctx)
101 101
   pic_descriptor->avc_log2_max_pic_order_cnt_lsb_minus4       = h->sps.log2_max_poc_lsb - 4;
102 102
   pic_descriptor->avc_num_ref_frames                          = h->sps.ref_frame_count;
103 103
   pic_descriptor->avc_reserved_8bit                           = 0;
  104
+  
  105
+  /* Set correct level */
  106
+  if (pic_descriptor->level == 41) 
  107
+  {
  108
+    const unsigned int mbw = pic_descriptor->width_in_mb;
  109
+    const unsigned int mbh = pic_descriptor->height_in_mb;
  110
+    const unsigned int max_ref_frames = 12288 * 1024 / (mbw * mbh * 384);
  111
+    const unsigned int num_ref_frames = pic_descriptor->avc_num_ref_frames;
  112
+    if (max_ref_frames < num_ref_frames)
  113
+        pic_descriptor->level = 51;
  114
+  }
104 115
 
105 116
   pic_descriptor->avc_num_slice_groups_minus1                 = h->pps.slice_group_count - 1;
106 117
   pic_descriptor->avc_num_ref_idx_l0_active_minus1            = h->pps.ref_count[0] - 1;

0 notes on commit c3ea86a

Please sign in to comment.
Something went wrong with that request. Please try again.