Merge commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4'
authorJames Almer <jamrial@gmail.com>
Wed, 8 Nov 2017 17:15:16 +0000 (14:15 -0300)
committerJames Almer <jamrial@gmail.com>
Wed, 8 Nov 2017 17:23:48 +0000 (14:23 -0300)
* commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4':
  h264dec: track the last seen value of x264_build

Merged-by: James Almer <jamrial@gmail.com>
1  2 
libavcodec/h264_cabac.c
libavcodec/h264_direct.c
libavcodec/h264_mb.c
libavcodec/h264_slice.c
libavcodec/h264dec.c
libavcodec/h264dec.h

@@@ -2347,40 -2329,21 +2347,40 @@@ decode_intra_mb
      if (CHROMA444(h) && IS_8x8DCT(mb_type)){
          int i;
          uint8_t *nnz_cache = sl->non_zero_count_cache;
-         if (h->sei.unregistered.x264_build < 151U) {
 -        for (i = 0; i < 2; i++){
 -            if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
 -                nnz_cache[3+8* 1 + 2*8*i]=
 -                nnz_cache[3+8* 2 + 2*8*i]=
 -                nnz_cache[3+8* 6 + 2*8*i]=
 -                nnz_cache[3+8* 7 + 2*8*i]=
 -                nnz_cache[3+8*11 + 2*8*i]=
 -                nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
++        if (h->x264_build < 151U) {
 +            for (i = 0; i < 2; i++){
 +                if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
 +                    nnz_cache[3+8* 1 + 2*8*i]=
 +                    nnz_cache[3+8* 2 + 2*8*i]=
 +                    nnz_cache[3+8* 6 + 2*8*i]=
 +                    nnz_cache[3+8* 7 + 2*8*i]=
 +                    nnz_cache[3+8*11 + 2*8*i]=
 +                    nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
 +                }
 +            }
 +            if (sl->top_type && !IS_8x8DCT(sl->top_type)){
 +                uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040;
 +                AV_WN32A(&nnz_cache[4+8* 0], top_empty);
 +                AV_WN32A(&nnz_cache[4+8* 5], top_empty);
 +                AV_WN32A(&nnz_cache[4+8*10], top_empty);
 +            }
 +        } else {
 +            for (i = 0; i < 2; i++){
 +                if (sl->left_type[LEFT(i)] && !IS_8x8DCT(sl->left_type[LEFT(i)])) {
 +                    nnz_cache[3+8* 1 + 2*8*i]=
 +                    nnz_cache[3+8* 2 + 2*8*i]=
 +                    nnz_cache[3+8* 6 + 2*8*i]=
 +                    nnz_cache[3+8* 7 + 2*8*i]=
 +                    nnz_cache[3+8*11 + 2*8*i]=
 +                    nnz_cache[3+8*12 + 2*8*i]= !IS_INTRA_PCM(sl->left_type[LEFT(i)]) ? 0 : 64;
 +                }
 +            }
 +            if (sl->top_type && !IS_8x8DCT(sl->top_type)){
 +                uint32_t top_empty = !IS_INTRA_PCM(sl->top_type) ? 0 : 0x40404040;
 +                AV_WN32A(&nnz_cache[4+8* 0], top_empty);
 +                AV_WN32A(&nnz_cache[4+8* 5], top_empty);
 +                AV_WN32A(&nnz_cache[4+8*10], top_empty);
              }
 -        }
 -        if (sl->top_type && !IS_8x8DCT(sl->top_type)){
 -            uint32_t top_empty = !IS_INTRA(mb_type) ? 0 : 0x40404040;
 -            AV_WN32A(&nnz_cache[4+8* 0], top_empty);
 -            AV_WN32A(&nnz_cache[4+8* 5], top_empty);
 -            AV_WN32A(&nnz_cache[4+8*10], top_empty);
          }
      }
      h->cur_pic.mb_type[mb_xy] = mb_type;
Simple merge
@@@ -637,12 -636,7 +637,12 @@@ static av_always_inline void hl_decode_
                  uint8_t *const ptr = dest_y + block_offset[i];
                  const int dir      = sl->intra4x4_pred_mode_cache[scan8[i]];
                  if (transform_bypass && h->ps.sps->profile_idc == 244 && dir <= 1) {
-                     if (h->sei.unregistered.x264_build < 151U) {
 -                    h->hpc.pred8x8l_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
++                    if (h->x264_build < 151U) {
 +                        h->hpc.pred8x8l_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift), linesize);
 +                    } else
 +                        h->hpc.pred8x8l_filter_add[dir](ptr, sl->mb + (i * 16 + p * 256 << pixel_shift),
 +                                                        (sl-> topleft_samples_available << i) & 0x8000,
 +                                                        (sl->topright_samples_available << i) & 0x4000, linesize);
                  } else {
                      const int nnz = sl->non_zero_count_cache[scan8[i + p * 16]];
                      h->hpc.pred8x8l[dir](ptr, (sl->topleft_samples_available << i) & 0x8000,
@@@ -912,10 -851,10 +915,10 @@@ static int h264_slice_header_init(H264C
  
      if (sps->timing_info_present_flag) {
          int64_t den = sps->time_scale;
-         if (h->sei.unregistered.x264_build < 44U)
+         if (h->x264_build < 44U)
              den *= 2;
          av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
 -                  sps->num_units_in_tick, den, 1 << 30);
 +                  sps->num_units_in_tick * h->avctx->ticks_per_frame, den, 1 << 30);
      }
  
      ff_h264_free_tables(h);
@@@ -315,10 -293,8 +315,11 @@@ static int h264_init_context(AVCodecCon
      h->flags                 = avctx->flags;
      h->poc.prev_poc_msb      = 1 << 16;
      h->recovery_frame        = -1;
+     h->x264_build            = -1;
      h->frame_recovered       = 0;
 +    h->poc.prev_frame_num    = -1;
 +    h->sei.frame_packing.frame_packing_arrangement_cancel_flag = -1;
 +    h->sei.unregistered.x264_build = -1;
  
      h->next_outputed_poc = INT_MIN;
      for (i = 0; i < MAX_DELAYED_PIC_COUNT; i++)
Simple merge