Mercurial > libavcodec.hg
comparison h264.c @ 5781:0b3aa6f4c313 libavcodec
Modifies macroblock addressing and current macroblock y-position for field decoding.
Adds convenience definition for pictures that are field or mbaff based. Part of PAFF implementation.
patch by Jeff Downs, heydowns a borg d com
original thread:
Subject: [FFmpeg-devel] [PATCH] Implement PAFF in H.264
Date: 18/09/07 20:30
author | andoma |
---|---|
date | Sat, 06 Oct 2007 05:59:14 +0000 |
parents | bd3d1e4f937a |
children | 58647a83d416 |
comparison
equal
deleted
inserted
replaced
5780:bd3d1e4f937a | 5781:0b3aa6f4c313 |
---|---|
175 if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[mb_xy-s->mb_stride]) && !FRAME_MBAFF) | 175 if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[mb_xy-s->mb_stride]) && !FRAME_MBAFF) |
176 return; | 176 return; |
177 | 177 |
178 //wow what a mess, why didn't they simplify the interlacing&intra stuff, i can't imagine that these complex rules are worth it | 178 //wow what a mess, why didn't they simplify the interlacing&intra stuff, i can't imagine that these complex rules are worth it |
179 | 179 |
180 top_xy = mb_xy - s->mb_stride; | 180 top_xy = mb_xy - (s->mb_stride << FIELD_PICTURE); |
181 topleft_xy = top_xy - 1; | 181 topleft_xy = top_xy - 1; |
182 topright_xy= top_xy + 1; | 182 topright_xy= top_xy + 1; |
183 left_xy[1] = left_xy[0] = mb_xy-1; | 183 left_xy[1] = left_xy[0] = mb_xy-1; |
184 left_block[0]= 0; | 184 left_block[0]= 0; |
185 left_block[1]= 1; | 185 left_block[1]= 1; |
3919 clone_slice(h, h0); | 3919 clone_slice(h, h0); |
3920 | 3920 |
3921 s->current_picture_ptr->frame_num= h->frame_num; //FIXME frame_num cleanup | 3921 s->current_picture_ptr->frame_num= h->frame_num; //FIXME frame_num cleanup |
3922 | 3922 |
3923 assert(s->mb_num == s->mb_width * s->mb_height); | 3923 assert(s->mb_num == s->mb_width * s->mb_height); |
3924 if(first_mb_in_slice << h->mb_aff_frame >= s->mb_num || | 3924 if(first_mb_in_slice << FIELD_OR_MBAFF_PICTURE >= s->mb_num || |
3925 first_mb_in_slice >= s->mb_num){ | 3925 first_mb_in_slice >= s->mb_num){ |
3926 av_log(h->s.avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); | 3926 av_log(h->s.avctx, AV_LOG_ERROR, "first_mb_in_slice overflow\n"); |
3927 return -1; | 3927 return -1; |
3928 } | 3928 } |
3929 s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width; | 3929 s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width; |
3930 s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << h->mb_aff_frame; | 3930 s->resync_mb_y = s->mb_y = (first_mb_in_slice / s->mb_width) << FIELD_OR_MBAFF_PICTURE; |
3931 if (s->picture_structure == PICT_BOTTOM_FIELD) | |
3932 s->resync_mb_y = s->mb_y = s->mb_y + 1; | |
3931 assert(s->mb_y < s->mb_height); | 3933 assert(s->mb_y < s->mb_height); |
3932 | 3934 |
3933 if(s->picture_structure==PICT_FRAME){ | 3935 if(s->picture_structure==PICT_FRAME){ |
3934 h->curr_pic_num= h->frame_num; | 3936 h->curr_pic_num= h->frame_num; |
3935 h->max_pic_num= 1<< h->sps.log2_max_frame_num; | 3937 h->max_pic_num= 1<< h->sps.log2_max_frame_num; |
4985 }else | 4987 }else |
4986 mbb_xy = mb_x + (mb_y-1)*s->mb_stride; | 4988 mbb_xy = mb_x + (mb_y-1)*s->mb_stride; |
4987 }else{ | 4989 }else{ |
4988 int mb_xy = mb_x + mb_y*s->mb_stride; | 4990 int mb_xy = mb_x + mb_y*s->mb_stride; |
4989 mba_xy = mb_xy - 1; | 4991 mba_xy = mb_xy - 1; |
4990 mbb_xy = mb_xy - s->mb_stride; | 4992 mbb_xy = mb_xy - (s->mb_stride << FIELD_PICTURE); |
4991 } | 4993 } |
4992 | 4994 |
4993 if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] )) | 4995 if( h->slice_table[mba_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mba_xy] )) |
4994 ctx++; | 4996 ctx++; |
4995 if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] )) | 4997 if( h->slice_table[mbb_xy] == h->slice_num && !IS_SKIP( s->current_picture.mb_type[mbb_xy] )) |
5429 h->top_mb_xy -= s->mb_stride; | 5431 h->top_mb_xy -= s->mb_stride; |
5430 } | 5432 } |
5431 if (left_mb_frame_flag != curr_mb_frame_flag) { | 5433 if (left_mb_frame_flag != curr_mb_frame_flag) { |
5432 h->left_mb_xy[0] = pair_xy - 1; | 5434 h->left_mb_xy[0] = pair_xy - 1; |
5433 } | 5435 } |
5436 } else if (FIELD_PICTURE) { | |
5437 h->top_mb_xy -= s->mb_stride; | |
5434 } | 5438 } |
5435 return; | 5439 return; |
5436 } | 5440 } |
5437 | 5441 |
5438 /** | 5442 /** |
6664 | 6668 |
6665 if( ++s->mb_x >= s->mb_width ) { | 6669 if( ++s->mb_x >= s->mb_width ) { |
6666 s->mb_x = 0; | 6670 s->mb_x = 0; |
6667 ff_draw_horiz_band(s, 16*s->mb_y, 16); | 6671 ff_draw_horiz_band(s, 16*s->mb_y, 16); |
6668 ++s->mb_y; | 6672 ++s->mb_y; |
6669 if(FRAME_MBAFF) { | 6673 if(FIELD_OR_MBAFF_PICTURE) { |
6670 ++s->mb_y; | 6674 ++s->mb_y; |
6671 } | 6675 } |
6672 } | 6676 } |
6673 | 6677 |
6674 if( eos || s->mb_y >= s->mb_height ) { | 6678 if( eos || s->mb_y >= s->mb_height ) { |
6701 | 6705 |
6702 if(++s->mb_x >= s->mb_width){ | 6706 if(++s->mb_x >= s->mb_width){ |
6703 s->mb_x=0; | 6707 s->mb_x=0; |
6704 ff_draw_horiz_band(s, 16*s->mb_y, 16); | 6708 ff_draw_horiz_band(s, 16*s->mb_y, 16); |
6705 ++s->mb_y; | 6709 ++s->mb_y; |
6706 if(FRAME_MBAFF) { | 6710 if(FIELD_OR_MBAFF_PICTURE) { |
6707 ++s->mb_y; | 6711 ++s->mb_y; |
6708 } | 6712 } |
6709 if(s->mb_y >= s->mb_height){ | 6713 if(s->mb_y >= s->mb_height){ |
6710 tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits); | 6714 tprintf(s->avctx, "slice end %d %d\n", get_bits_count(&s->gb), s->gb.size_in_bits); |
6711 | 6715 |