Revision b735aeea

View differences:

libavcodec/h264.c
178 178
    if(for_deblock){
179 179
        topleft_type = 0;
180 180
        topright_type = 0;
181
        top_type     = h->slice_table[top_xy     ] < 255 ? s->current_picture.mb_type[top_xy]     : 0;
182
        left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0;
183
        left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0;
181
        top_type     = h->slice_table[top_xy     ] < 0xFFFF ? s->current_picture.mb_type[top_xy]     : 0;
182
        left_type[0] = h->slice_table[left_xy[0] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[0]] : 0;
183
        left_type[1] = h->slice_table[left_xy[1] ] < 0xFFFF ? s->current_picture.mb_type[left_xy[1]] : 0;
184 184

  
185 185
        if(MB_MBAFF && !IS_INTRA(mb_type)){
186 186
            int list;
......
2120 2120
    CHECKED_ALLOCZ(h->intra4x4_pred_mode, big_mb_num * 8  * sizeof(uint8_t))
2121 2121

  
2122 2122
    CHECKED_ALLOCZ(h->non_zero_count    , big_mb_num * 16 * sizeof(uint8_t))
2123
    CHECKED_ALLOCZ(h->slice_table_base  , (big_mb_num+s->mb_stride) * sizeof(uint8_t))
2123
    CHECKED_ALLOCZ(h->slice_table_base  , (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base))
2124 2124
    CHECKED_ALLOCZ(h->cbp_table, big_mb_num * sizeof(uint16_t))
2125 2125

  
2126 2126
    CHECKED_ALLOCZ(h->chroma_pred_mode_table, big_mb_num * sizeof(uint8_t))
......
2128 2128
    CHECKED_ALLOCZ(h->mvd_table[1], 32*big_mb_num * sizeof(uint16_t));
2129 2129
    CHECKED_ALLOCZ(h->direct_table, 32*big_mb_num * sizeof(uint8_t));
2130 2130

  
2131
    memset(h->slice_table_base, -1, (big_mb_num+s->mb_stride)  * sizeof(uint8_t));
2131
    memset(h->slice_table_base, -1, (big_mb_num+s->mb_stride)  * sizeof(*h->slice_table_base));
2132 2132
    h->slice_table= h->slice_table_base + s->mb_stride*2 + 1;
2133 2133

  
2134 2134
    CHECKED_ALLOCZ(h->mb2b_xy  , big_mb_num * sizeof(uint32_t));
......
2278 2278

  
2279 2279
    /* some macroblocks will be accessed before they're available */
2280 2280
    if(FRAME_MBAFF || s->avctx->thread_count > 1)
2281
        memset(h->slice_table, -1, (s->mb_height*s->mb_stride-1) * sizeof(uint8_t));
2281
        memset(h->slice_table, -1, (s->mb_height*s->mb_stride-1) * sizeof(*h->slice_table));
2282 2282

  
2283 2283
//    s->decode= (s->flags&CODEC_FLAG_PSNR) || !s->encoding || s->current_picture.reference /*|| h->contains_intra*/ || 1;
2284 2284

  
......
4020 4020

  
4021 4021
    h0->last_slice_type = slice_type;
4022 4022
    h->slice_num = ++h0->current_slice;
4023
    if(h->slice_num >= MAX_SLICES){
4024
        av_log(s->avctx, AV_LOG_ERROR, "Too many slices, increase MAX_SLICES and recompile\n");
4025
    }
4023 4026

  
4024 4027
    for(j=0; j<2; j++){
4025
        int *ref2frm= h->ref2frm[h->slice_num&15][j];
4028
        int *ref2frm= h->ref2frm[h->slice_num&(MAX_SLICES-1)][j];
4026 4029
        ref2frm[0]=
4027 4030
        ref2frm[1]= -1;
4028 4031
        for(i=0; i<16; i++)
......
6359 6362

  
6360 6363
    if (FRAME_MBAFF
6361 6364
            // left mb is in picture
6362
            && h->slice_table[mb_xy-1] != 255
6365
            && h->slice_table[mb_xy-1] != 0xFFFF
6363 6366
            // and current and left pair do not have the same interlaced type
6364 6367
            && (IS_INTERLACED(mb_type) != IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]))
6365 6368
            // and left mb is in the same slice if deblocking_filter == 2
......
6423 6426
        int edge;
6424 6427
        const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy;
6425 6428
        const int mbm_type = s->current_picture.mb_type[mbm_xy];
6426
        int (*ref2frm) [64] = h->ref2frm[ h->slice_num          &15 ][0] + (MB_MBAFF ? 20 : 2);
6427
        int (*ref2frmm)[64] = h->ref2frm[ h->slice_table[mbm_xy]&15 ][0] + (MB_MBAFF ? 20 : 2);
6428
        int start = h->slice_table[mbm_xy] == 255 ? 1 : 0;
6429
        int (*ref2frm) [64] = h->ref2frm[ h->slice_num          &(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
6430
        int (*ref2frmm)[64] = h->ref2frm[ h->slice_table[mbm_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
6431
        int start = h->slice_table[mbm_xy] == 0xFFFF ? 1 : 0;
6429 6432

  
6430 6433
        const int edges = (mb_type & (MB_TYPE_16x16|MB_TYPE_SKIP))
6431 6434
                                  == (MB_TYPE_16x16|MB_TYPE_SKIP) ? 1 : 4;
libavcodec/h264.h
59 59

  
60 60
#define ALLOW_NOCHROMA
61 61

  
62
/**
63
 * The maximum number of slices supported by the decoder.
64
 * must be a power of 2
65
 */
66
#define MAX_SLICES 16
67

  
62 68
#ifdef ALLOW_INTERLACE
63 69
#define MB_MBAFF h->mb_mbaff
64 70
#define MB_FIELD h->mb_field_decoding_flag
......
296 302
    int dequant_coeff_pps;     ///< reinit tables when pps changes
297 303

  
298 304
    int slice_num;
299
    uint8_t *slice_table_base;
300
    uint8_t *slice_table;      ///< slice_table_base + 2*mb_stride + 1
305
    uint16_t *slice_table_base;
306
    uint16_t *slice_table;     ///< slice_table_base + 2*mb_stride + 1
301 307
    int slice_type;
302 308
    int slice_type_nos;        ///< S free slice type (SI/SP are remapped to I/P)
303 309
    int slice_type_fixed;
......
366 372
    Picture ref_list[2][48];         /**< 0..15: frame refs, 16..47: mbaff field refs.
367 373
                                          Reordered version of default_ref_list
368 374
                                          according to picture reordering in slice header */
369
    int ref2frm[16][2][64];          ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
375
    int ref2frm[MAX_SLICES][2][64];  ///< reference to frame number lists, used in the loop filter, the first 2 are for -2,-1
370 376
    Picture *delayed_pic[MAX_DELAYED_PIC_COUNT+2]; //FIXME size?
371 377
    int outputed_poc;
372 378

  

Also available in: Unified diff