func: static int hls_slice_data_wpp(HEVCContext *s, const HEVCNAL *nal)
  
  {
  
      const uint8_t *data = nal->data;
  
      int length          = nal->size;
  
      HEVCLocalContext *lc = s->HEVClc;
  
      int *ret = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
  
      int *arg = av_malloc_array(s->sh.num_entry_point_offsets + 1, sizeof(int));
  
      int64_t offset;
  
      int startheader, cmpt = 0;
  
      int i, j, res = 0;
  
  
  
      if (!ret || !arg) {
  
          av_free(ret);
  
          av_free(arg);
  
          return AVERROR(ENOMEM);
  
      }
  
  
  
  
  
      if (!s->sList[1]) {
  
          ff_alloc_entries(s->avctx, s->sh.num_entry_point_offsets + 1);
  
  
  
  
  
          for (i = 1; i < s->threads_number; i++) {
  
              s->sList[i] = av_malloc(sizeof(HEVCContext));
  
              memcpy(s->sList[i], s, sizeof(HEVCContext));
  
              s->HEVClcList[i] = av_mallocz(sizeof(HEVCLocalContext));
  
              s->sList[i]->HEVClc = s->HEVClcList[i];
  
          }
  
      }
  
  
  
      offset = (lc->gb.index >> 3);
  
  
  
      for (j = 0, cmpt = 0, startheader = offset + s->sh.entry_point_offset[0]; j < nal->skipped_bytes; j++) {
  
          if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) {
  
              startheader--;
  
              cmpt++;
  
          }
  
      }
  
  
  
      for (i = 1; i < s->sh.num_entry_point_offsets; i++) {
  
          offset += (s->sh.entry_point_offset[i - 1] - cmpt);
  
          for (j = 0, cmpt = 0, startheader = offset
  
               + s->sh.entry_point_offset[i]; j < nal->skipped_bytes; j++) {
  
              if (nal->skipped_bytes_pos[j] >= offset && nal->skipped_bytes_pos[j] < startheader) {
  
                  startheader--;
  
                  cmpt++;
  
              }
  
          }
  
          s->sh.size[i - 1] = s->sh.entry_point_offset[i] - cmpt;
  
          s->sh.offset[i - 1] = offset;
  
  
  
      }
  
      if (s->sh.num_entry_point_offsets != 0) {
  
          offset += s->sh.entry_point_offset[s->sh.num_entry_point_offsets - 1] - cmpt;
  
          if (length < offset) {
  
              av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n");
  
              res = AVERROR_INVALIDDATA;
  
              goto error;
  
          }
  
          s->sh.size[s->sh.num_entry_point_offsets - 1] = length - offset;
  
          s->sh.offset[s->sh.num_entry_point_offsets - 1] = offset;
  
  
  
      }
  
      s->data = data;
  
  
  
      for (i = 1; i < s->threads_number; i++) {
  
          s->sList[i]->HEVClc->first_qp_group = 1;
  
          s->sList[i]->HEVClc->qp_y = s->sList[0]->HEVClc->qp_y;
  
          memcpy(s->sList[i], s, sizeof(HEVCContext));
  
          s->sList[i]->HEVClc = s->HEVClcList[i];
  
      }
  
  
  
      avpriv_atomic_int_set(&s->wpp_err, 0);
  
      ff_reset_entries(s->avctx);
  
  
  
      for (i = 0; i <= s->sh.num_entry_point_offsets; i++) {
  
          arg[i] = i;
  
          ret[i] = 0;
  
      }
  
  
  
      if (s->ps.pps->entropy_coding_sync_enabled_flag)
  
          s->avctx->execute2(s->avctx, hls_decode_entry_wpp, arg, ret, s->sh.num_entry_point_offsets + 1);
  
  
  
      for (i = 0; i <= s->sh.num_entry_point_offsets; i++)
  
          res += ret[i];
  
  error:
  
      av_free(ret);
  
      av_free(arg);
  
      return res;
  
  }
  