Revision 7bc9090a libavcodec/h264.c

View differences:

libavcodec/h264.c
149 149
    uint8_t *rbsp_buffer;
150 150
    int rbsp_buffer_size;
151 151

  
152
    int mb_stride; ///< stride of some mb tables
153

  
154 152
    int chroma_qp; //QPc
155 153

  
156 154
    int prev_mb_skiped; //FIXME remove (IMHO not used)
......
355 353

  
356 354
static inline void fill_caches(H264Context *h, int mb_type){
357 355
    MpegEncContext * const s = &h->s;
358
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
356
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
359 357
    int topleft_xy, top_xy, topright_xy, left_xy[2];
360 358
    int topleft_type, top_type, topright_type, left_type[2];
361 359
    int left_block[4];
......
366 364
    if(h->sps.mb_aff){
367 365
    //FIXME
368 366
    }else{
369
        topleft_xy = mb_xy-1 - h->mb_stride;
370
        top_xy     = mb_xy   - h->mb_stride;
371
        topright_xy= mb_xy+1 - h->mb_stride;
367
        topleft_xy = mb_xy-1 - s->mb_stride;
368
        top_xy     = mb_xy   - s->mb_stride;
369
        topright_xy= mb_xy+1 - s->mb_stride;
372 370
        left_xy[0]   = mb_xy-1;
373 371
        left_xy[1]   = mb_xy-1;
374 372
        left_block[0]= 0;
......
602 600

  
603 601
static inline void write_back_intra_pred_mode(H264Context *h){
604 602
    MpegEncContext * const s = &h->s;
605
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
603
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
606 604

  
607 605
    h->intra4x4_pred_mode[mb_xy][0]= h->intra4x4_pred_mode_cache[7+8*1];
608 606
    h->intra4x4_pred_mode[mb_xy][1]= h->intra4x4_pred_mode_cache[7+8*2];
......
693 691

  
694 692
static inline void write_back_non_zero_count(H264Context *h){
695 693
    MpegEncContext * const s = &h->s;
696
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
694
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
697 695

  
698 696
    h->non_zero_count[mb_xy][0]= h->non_zero_count_cache[4+8*4];
699 697
    h->non_zero_count[mb_xy][1]= h->non_zero_count_cache[5+8*4];
......
896 894

  
897 895
static inline void write_back_motion(H264Context *h, int mb_type){
898 896
    MpegEncContext * const s = &h->s;
899
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
897
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
900 898
    const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
901 899
    const int b8_xy= 2*s->mb_x + 2*s->mb_y*h->b8_stride;
902 900
    int list;
......
1952 1950
                      qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
1953 1951
                      qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg)){
1954 1952
    MpegEncContext * const s = &h->s;
1955
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
1953
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
1956 1954
    const int mb_type= s->current_picture.mb_type[mb_xy];
1957 1955
    
1958 1956
    assert(IS_INTER(mb_type));
......
2122 2120
 */
2123 2121
static int alloc_tables(H264Context *h){
2124 2122
    MpegEncContext * const s = &h->s;
2125
    const int big_mb_num= h->mb_stride * (s->mb_height+1);
2123
    const int big_mb_num= s->mb_stride * (s->mb_height+1);
2126 2124
    int x,y;
2127 2125

  
2128 2126
    CHECKED_ALLOCZ(h->intra4x4_pred_mode, big_mb_num * 8  * sizeof(uint8_t))
......
2130 2128
    CHECKED_ALLOCZ(h->slice_table_base  , big_mb_num * sizeof(uint8_t))
2131 2129

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

  
2135 2133
    CHECKED_ALLOCZ(h->mb2b_xy  , big_mb_num * sizeof(uint16_t));
2136 2134
    CHECKED_ALLOCZ(h->mb2b8_xy , big_mb_num * sizeof(uint16_t));
2137 2135
    for(y=0; y<s->mb_height; y++){
2138 2136
        for(x=0; x<s->mb_width; x++){
2139
            const int mb_xy= x + y*h->mb_stride;
2137
            const int mb_xy= x + y*s->mb_stride;
2140 2138
            const int b_xy = 4*x + 4*y*h->b_stride;
2141 2139
            const int b8_xy= 2*x + 2*y*h->b8_stride;
2142 2140
        
......
2211 2209
    MpegEncContext * const s = &h->s;
2212 2210
    const int mb_x= s->mb_x;
2213 2211
    const int mb_y= s->mb_y;
2214
    const int mb_xy= mb_x + mb_y*h->mb_stride;
2212
    const int mb_xy= mb_x + mb_y*s->mb_stride;
2215 2213
    const int mb_type= s->current_picture.mb_type[mb_xy];
2216 2214
    uint8_t  *dest_y, *dest_cb, *dest_cr;
2217 2215
    int linesize, uvlinesize /*dct_offset*/;
......
2839 2837
    
2840 2838
    s->mb_width= h->sps.mb_width;
2841 2839
    s->mb_height= h->sps.mb_height;
2842
    h->mb_stride= s->mb_width + 1;
2843 2840
    
2844 2841
    h->b_stride=  s->mb_width*4;
2845 2842
    h->b8_stride= s->mb_width*2;
......
3171 3168
 */
3172 3169
static int decode_mb(H264Context *h){
3173 3170
    MpegEncContext * const s = &h->s;
3174
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
3171
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
3175 3172
    int mb_type, partition_count, cbp;
3176 3173

  
3177 3174
    memset(h->mb, 0, sizeof(int16_t)*24*16); //FIXME avoid if allready clear (move after skip handlong?
......
4164 4161
    }
4165 4162

  
4166 4163
    *pict= *(AVFrame*)&s->current_picture; //FIXME 
4164
    ff_print_debug_info(s, s->current_picture_ptr);
4167 4165
    assert(pict->data[0]);
4168 4166
//printf("out %d\n", (int)pict->data[0]);
4169 4167
#if 0 //?
......
4183 4181
#if 0
4184 4182
static inline void fill_mb_avail(H264Context *h){
4185 4183
    MpegEncContext * const s = &h->s;
4186
    const int mb_xy= s->mb_x + s->mb_y*h->mb_stride;
4184
    const int mb_xy= s->mb_x + s->mb_y*s->mb_stride;
4187 4185

  
4188 4186
    if(s->mb_y){
4189
        h->mb_avail[0]= s->mb_x                 && h->slice_table[mb_xy - h->mb_stride - 1] == h->slice_num;
4190
        h->mb_avail[1]=                            h->slice_table[mb_xy - h->mb_stride    ] == h->slice_num;
4191
        h->mb_avail[2]= s->mb_x+1 < s->mb_width && h->slice_table[mb_xy - h->mb_stride + 1] == h->slice_num;
4187
        h->mb_avail[0]= s->mb_x                 && h->slice_table[mb_xy - s->mb_stride - 1] == h->slice_num;
4188
        h->mb_avail[1]=                            h->slice_table[mb_xy - s->mb_stride    ] == h->slice_num;
4189
        h->mb_avail[2]= s->mb_x+1 < s->mb_width && h->slice_table[mb_xy - s->mb_stride + 1] == h->slice_num;
4192 4190
    }else{
4193 4191
        h->mb_avail[0]=
4194 4192
        h->mb_avail[1]=

Also available in: Unified diff