static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
{
    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));
    int offset;
    int startheader, cmpt = 0;
    int i, j, res = 0;
    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 < s->skipped_bytes; j++) {
        if (s->skipped_bytes_pos[j] >= offset && s->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 < s->skipped_bytes; j++) {
            if (s->skipped_bytes_pos[j] >= offset && s->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;
        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 = nal;
    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->pps->entropy_coding_sync_enabled_flag)
        s->avctx->execute2(s->avctx, (void *) 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];
    return res;
static int hls_slice_data_wpp(HEVCContext *s, const uint8_t *nal, int length)
{
    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));
    int offset;
    int startheader, cmpt = 0;
    int i, j, res = 0;
    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 < s->skipped_bytes; j++) {
        if (s->skipped_bytes_pos[j] >= offset && s->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 < s->skipped_bytes; j++) {
            if (s->skipped_bytes_pos[j] >= offset && s->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;
        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 = nal;
    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->pps->entropy_coding_sync_enabled_flag)
        s->avctx->execute2(s->avctx, (void *) 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];
    return res;
static int FUNC_0(HEVCContext *VAR_0, const uint8_t *VAR_1, int VAR_2)
{
    HEVCLocalContext *lc = VAR_0->HEVClc;
    int *VAR_3 = av_malloc_array(VAR_0->sh.num_entry_point_offsets + 1, sizeof(int));
    int *VAR_4 = av_malloc_array(VAR_0->sh.num_entry_point_offsets + 1, sizeof(int));
    int VAR_5;
    int VAR_6, VAR_7 = 0;
    int VAR_8, VAR_9, VAR_10 = 0;
    if (!VAR_0->sList[1]) {
        ff_alloc_entries(VAR_0->avctx, VAR_0->sh.num_entry_point_offsets + 1);
        for (VAR_8 = 1; VAR_8 < VAR_0->threads_number; VAR_8++) {
            VAR_0->sList[VAR_8] = av_malloc(sizeof(HEVCContext));
            memcpy(VAR_0->sList[VAR_8], VAR_0, sizeof(HEVCContext));
            VAR_0->HEVClcList[VAR_8] = av_mallocz(sizeof(HEVCLocalContext));
            VAR_0->sList[VAR_8]->HEVClc = VAR_0->HEVClcList[VAR_8];
    VAR_5 = (lc->gb.index >> 3);
    for (VAR_9 = 0, VAR_7 = 0, VAR_6 = VAR_5 + VAR_0->sh.entry_point_offset[0]; VAR_9 < VAR_0->skipped_bytes; VAR_9++) {
        if (VAR_0->skipped_bytes_pos[VAR_9] >= VAR_5 && VAR_0->skipped_bytes_pos[VAR_9] < VAR_6) {
            VAR_6--;
            VAR_7++;
    for (VAR_8 = 1; VAR_8 < VAR_0->sh.num_entry_point_offsets; VAR_8++) {
        VAR_5 += (VAR_0->sh.entry_point_offset[VAR_8 - 1] - VAR_7);
        for (VAR_9 = 0, VAR_7 = 0, VAR_6 = VAR_5
             + VAR_0->sh.entry_point_offset[VAR_8]; VAR_9 < VAR_0->skipped_bytes; VAR_9++) {
            if (VAR_0->skipped_bytes_pos[VAR_9] >= VAR_5 && VAR_0->skipped_bytes_pos[VAR_9] < VAR_6) {
                VAR_6--;
                VAR_7++;
        VAR_0->sh.size[VAR_8 - 1] = VAR_0->sh.entry_point_offset[VAR_8] - VAR_7;
        VAR_0->sh.VAR_5[VAR_8 - 1] = VAR_5;
    if (VAR_0->sh.num_entry_point_offsets != 0) {
        VAR_5 += VAR_0->sh.entry_point_offset[VAR_0->sh.num_entry_point_offsets - 1] - VAR_7;
        VAR_0->sh.size[VAR_0->sh.num_entry_point_offsets - 1] = VAR_2 - VAR_5;
        VAR_0->sh.VAR_5[VAR_0->sh.num_entry_point_offsets - 1] = VAR_5;
    VAR_0->data = VAR_1;
    for (VAR_8 = 1; VAR_8 < VAR_0->threads_number; VAR_8++) {
        VAR_0->sList[VAR_8]->HEVClc->first_qp_group = 1;
        VAR_0->sList[VAR_8]->HEVClc->qp_y = VAR_0->sList[0]->HEVClc->qp_y;
        memcpy(VAR_0->sList[VAR_8], VAR_0, sizeof(HEVCContext));
        VAR_0->sList[VAR_8]->HEVClc = VAR_0->HEVClcList[VAR_8];
    avpriv_atomic_int_set(&VAR_0->wpp_err, 0);
    ff_reset_entries(VAR_0->avctx);
    for (VAR_8 = 0; VAR_8 <= VAR_0->sh.num_entry_point_offsets; VAR_8++) {
        VAR_4[VAR_8] = VAR_8;
        VAR_3[VAR_8] = 0;
    if (VAR_0->pps->entropy_coding_sync_enabled_flag)
        VAR_0->avctx->execute2(VAR_0->avctx, (void *) hls_decode_entry_wpp, VAR_4, VAR_3, VAR_0->sh.num_entry_point_offsets + 1);
    for (VAR_8 = 0; VAR_8 <= VAR_0->sh.num_entry_point_offsets; VAR_8++)
        VAR_10 += VAR_3[VAR_8];
    return VAR_10;
static int FUNC_0(HEVCContext *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ HEVCLocalContext *lc = VAR_0->HEVClc; int *VAR_3 = av_malloc_array(VAR_0->sh.num_entry_point_offsets + 1, sizeof(int)); int *VAR_4 = av_malloc_array(VAR_0->sh.num_entry_point_offsets + 1, sizeof(int)); int VAR_5; int VAR_6, VAR_7 = 0; int VAR_8, VAR_9, VAR_10 = 0; if (!VAR_0->sList[1]) { ff_alloc_entries(VAR_0->avctx, VAR_0->sh.num_entry_point_offsets + 1); for (VAR_8 = 1; VAR_8 < VAR_0->threads_number; VAR_8++) { VAR_0->sList[VAR_8] = av_malloc(sizeof(HEVCContext)); memcpy(VAR_0->sList[VAR_8], VAR_0, sizeof(HEVCContext)); VAR_0->HEVClcList[VAR_8] = av_mallocz(sizeof(HEVCLocalContext)); VAR_0->sList[VAR_8]->HEVClc = VAR_0->HEVClcList[VAR_8]; VAR_5 = (lc->gb.index >> 3); for (VAR_9 = 0, VAR_7 = 0, VAR_6 = VAR_5 + VAR_0->sh.entry_point_offset[0]; VAR_9 < VAR_0->skipped_bytes; VAR_9++) { if (VAR_0->skipped_bytes_pos[VAR_9] >= VAR_5 && VAR_0->skipped_bytes_pos[VAR_9] < VAR_6) { VAR_6--; VAR_7++; for (VAR_8 = 1; VAR_8 < VAR_0->sh.num_entry_point_offsets; VAR_8++) { VAR_5 += (VAR_0->sh.entry_point_offset[VAR_8 - 1] - VAR_7); for (VAR_9 = 0, VAR_7 = 0, VAR_6 = VAR_5
+ VAR_0->sh.entry_point_offset[VAR_8]; VAR_9 < VAR_0->skipped_bytes; VAR_9++) { if (VAR_0->skipped_bytes_pos[VAR_9] >= VAR_5 && VAR_0->skipped_bytes_pos[VAR_9] < VAR_6) { VAR_6--; VAR_7++; VAR_0->sh.size[VAR_8 - 1] = VAR_0->sh.entry_point_offset[VAR_8] - VAR_7; VAR_0->sh.VAR_5[VAR_8 - 1] = VAR_5; if (VAR_0->sh.num_entry_point_offsets != 0) { VAR_5 += VAR_0->sh.entry_point_offset[VAR_0->sh.num_entry_point_offsets - 1] - VAR_7; VAR_0->sh.size[VAR_0->sh.num_entry_point_offsets - 1] = VAR_2 - VAR_5; VAR_0->sh.VAR_5[VAR_0->sh.num_entry_point_offsets - 1] = VAR_5; VAR_0->data = VAR_1; for (VAR_8 = 1; VAR_8 < VAR_0->threads_number; VAR_8++) { VAR_0->sList[VAR_8]->HEVClc->first_qp_group = 1; VAR_0->sList[VAR_8]->HEVClc->qp_y = VAR_0->sList[0]->HEVClc->qp_y; memcpy(VAR_0->sList[VAR_8], VAR_0, sizeof(HEVCContext)); VAR_0->sList[VAR_8]->HEVClc = VAR_0->HEVClcList[VAR_8]; avpriv_atomic_int_set(&VAR_0->wpp_err, 0); ff_reset_entries(VAR_0->avctx); for (VAR_8 = 0; VAR_8 <= VAR_0->sh.num_entry_point_offsets; VAR_8++) { VAR_4[VAR_8] = VAR_8; VAR_3[VAR_8] = 0; if (VAR_0->pps->entropy_coding_sync_enabled_flag)
VAR_0->avctx->execute2(VAR_0->avctx, (void *) hls_decode_entry_wpp, VAR_4, VAR_3, VAR_0->sh.num_entry_point_offsets + 1); for (VAR_8 = 0; VAR_8 <= VAR_0->sh.num_entry_point_offsets; VAR_8++) VAR_10 += VAR_3[VAR_8]; return VAR_10;