[FFmpeg-cvslog] Merge commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4'

James Almer git at videolan.org
Wed Nov 8 19:32:17 EET 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Nov  8 14:15:16 2017 -0300| [bc987cf91dd9975b0949bb5f91b9f266ca53e0ff] | committer: James Almer

Merge commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4'

* commit '45c4bf3df03ef53ae61fa1473424d4ae024f22e4':
  h264dec: track the last seen value of x264_build

Merged-by: James Almer <jamrial at gmail.com>

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

 libavcodec/h264_cabac.c  | 2 +-
 libavcodec/h264_direct.c | 4 ++--
 libavcodec/h264_mb.c     | 2 +-
 libavcodec/h264_slice.c  | 7 +++++--
 libavcodec/h264dec.c     | 1 +
 libavcodec/h264dec.h     | 1 +
 6 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 345834645c..ec5fc74b9b 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -2347,7 +2347,7 @@ 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) {
+        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]=
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index a7a107c8c2..ec9fca0350 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -410,7 +410,7 @@ single_col:
              (l1ref0[0] < 0 && !l1ref1[0] &&
               FFABS(l1mv1[0][0]) <= 1 &&
               FFABS(l1mv1[0][1]) <= 1 &&
-              h->sei.unregistered.x264_build > 33U))) {
+              h->x264_build > 33U))) {
             a = b = 0;
             if (ref[0] > 0)
                 a = mv[0];
@@ -445,7 +445,7 @@ single_col:
                 (l1ref0[i8] == 0 ||
                  (l1ref0[i8] < 0 &&
                   l1ref1[i8] == 0 &&
-                  h->sei.unregistered.x264_build > 33U))) {
+                  h->x264_build > 33U))) {
                 const int16_t (*l1mv)[2] = l1ref0[i8] == 0 ? l1mv0 : l1mv1;
                 if (IS_SUB_8X8(sub_mb_type)) {
                     const int16_t *mv_col = l1mv[x8 * 3 + y8 * 3 * b4_stride];
diff --git a/libavcodec/h264_mb.c b/libavcodec/h264_mb.c
index cb9fe856b2..3cd17b7e4b 100644
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@ -637,7 +637,7 @@ static av_always_inline void hl_decode_mb_predict_luma(const H264Context *h,
                 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) {
+                    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),
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 35dcabd611..94a1547ad6 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -399,12 +399,12 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
     h->enable_er       = h1->enable_er;
     h->workaround_bugs = h1->workaround_bugs;
+    h->x264_build      = h1->x264_build;
     h->droppable       = h1->droppable;
 
     // extradata/NAL handling
     h->is_avc = h1->is_avc;
     h->nal_length_size = h1->nal_length_size;
-    h->sei.unregistered.x264_build = h1->sei.unregistered.x264_build;
 
     memcpy(&h->poc,        &h1->poc,        sizeof(h->poc));
 
@@ -545,6 +545,9 @@ static int h264_frame_start(H264Context *h)
 
     h->mb_aff_frame = h->ps.sps->mb_aff && (h->picture_structure == PICT_FRAME);
 
+    if (h->sei.unregistered.x264_build >= 0)
+        h->x264_build = h->sei.unregistered.x264_build;
+
     assert(h->cur_pic_ptr->long_ref == 0);
 
     return 0;
@@ -912,7 +915,7 @@ static int h264_slice_header_init(H264Context *h)
 
     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 * h->avctx->ticks_per_frame, den, 1 << 30);
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 4216b66684..aed23c4fba 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -315,6 +315,7 @@ static int h264_init_context(AVCodecContext *avctx, H264Context *h)
     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;
diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h
index 2106ba077e..b87b947f95 100644
--- a/libavcodec/h264dec.h
+++ b/libavcodec/h264dec.h
@@ -365,6 +365,7 @@ typedef struct H264Context {
     int context_initialized;
     int flags;
     int workaround_bugs;
+    int x264_build;
     /* Set when slice threading is used and at least one slice uses deblocking
      * mode 1 (i.e. across slice boundaries). Then we disable the loop filter
      * during normal MB decoding and execute it serially at the end.


======================================================================

diff --cc libavcodec/h264_cabac.c
index 345834645c,b28e486e52..ec5fc74b9b
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@@ -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;
diff --cc libavcodec/h264_mb.c
index cb9fe856b2,f037bd5163..3cd17b7e4b
--- a/libavcodec/h264_mb.c
+++ b/libavcodec/h264_mb.c
@@@ -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,
diff --cc libavcodec/h264_slice.c
index 35dcabd611,e7408b24b5..94a1547ad6
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -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);
diff --cc libavcodec/h264dec.c
index 4216b66684,7a8293efa5..aed23c4fba
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@@ -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++)



More information about the ffmpeg-cvslog mailing list