Merge commit 'e0652795292223f8bc8e5bac019c1fca7323d23c'
authorClément Bœsch <clement@stupeflix.com>
Tue, 21 Jun 2016 08:19:13 +0000 (10:19 +0200)
committerClément Bœsch <clement@stupeflix.com>
Tue, 21 Jun 2016 08:24:31 +0000 (10:24 +0200)
* commit 'e0652795292223f8bc8e5bac019c1fca7323d23c':
  h264: remove an artificial restriction on the number of slice threads

Tested with multiple runs of fate-h264 THREADS=50 THREAD_TYPE=slice

Merged-by: Clément Bœsch <clement@stupeflix.com>
1  2 
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_slice.c

@@@ -305,14 -283,8 +305,13 @@@ static int h264_init_context(AVCodecCon
      int i;
  
      h->avctx                 = avctx;
 +    h->backup_width          = -1;
 +    h->backup_height         = -1;
 +    h->backup_pix_fmt        = AV_PIX_FMT_NONE;
 +    h->current_sps_id        = -1;
 +    h->cur_chroma_format_idc = -1;
  
      h->picture_structure     = PICT_FRAME;
-     h->slice_context_count   = 1;
      h->workaround_bugs       = avctx->workaround_bugs;
      h->flags                 = avctx->flags;
      h->poc.prev_poc_msb      = 1 << 16;
@@@ -878,14 -806,9 +877,12 @@@ static int decode_nal_units(H264Contex
      AVCodecContext *const avctx = h->avctx;
      unsigned context_count = 0;
      int nals_needed = 0; ///< number of NALs that need decoding before the next frame thread starts
 +    int idr_cleared=0;
      int i, ret = 0;
  
-     if(!h->slice_context_count)
-          h->slice_context_count= 1;
-     h->max_contexts = h->slice_context_count;
 +    h->nal_unit_type= 0;
 +
+     h->max_contexts = h->nb_slice_ctx;
      if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS)) {
          h->current_slice = 0;
          if (!h->first_field)
@@@ -48,8 -48,7 +48,7 @@@
  #include "rectangle.h"
  #include "videodsp.h"
  
 -#define H264_MAX_PICTURE_COUNT 32
 +#define H264_MAX_PICTURE_COUNT 36
- #define H264_MAX_THREADS       32
  
  #define MAX_SPS_COUNT          32
  #define MAX_PPS_COUNT         256
@@@ -623,14 -592,6 +622,12 @@@ typedef struct H264Context 
       */
      int max_contexts;
  
-     int slice_context_count;
 +    /**
 +     *  1 if the single thread fallback warning has already been
 +     *  displayed, 0 otherwise.
 +     */
 +    int single_decode_warning;
 +
      /** @} */
  
      /**
@@@ -998,10 -878,10 +982,10 @@@ static int h264_slice_header_init(H264C
          ret = ff_h264_slice_context_init(h, &h->slice_ctx[0]);
          if (ret < 0) {
              av_log(h->avctx, AV_LOG_ERROR, "context_init() failed.\n");
 -            return ret;
 +            goto fail;
          }
      } else {
-         for (i = 0; i < h->slice_context_count; i++) {
+         for (i = 0; i < h->nb_slice_ctx; i++) {
              H264SliceContext *sl = &h->slice_ctx[i];
  
              sl->h264               = h;