Mercurial > libavcodec.hg
comparison h264.c @ 5825:18859ffa5705 libavcodec
Fix chroma mv offsets for PAFF in a way that is compatible with MBAFF by
setting Picture.reference to indicate parity for all Pictures in
reference list.
Patch by Jeff Downs, heydowns T borg O com
author | cehoyos |
---|---|
date | Mon, 15 Oct 2007 22:17:39 +0000 |
parents | b49be74d387c |
children | 731ee5ad6bde |
comparison
equal
deleted
inserted
replaced
5824:6ac956b341f2 | 5825:18859ffa5705 |
---|---|
1727 | 1727 |
1728 if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; | 1728 if(ENABLE_GRAY && s->flags&CODEC_FLAG_GRAY) return; |
1729 | 1729 |
1730 if(MB_FIELD){ | 1730 if(MB_FIELD){ |
1731 // chroma offset when predicting from a field of opposite parity | 1731 // chroma offset when predicting from a field of opposite parity |
1732 my += 2 * ((s->mb_y & 1) - (h->ref_cache[list][scan8[n]] & 1)); | 1732 my += 2 * ((s->mb_y & 1) - (pic->reference - 1)); |
1733 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); | 1733 emu |= (my>>3) < 0 || (my>>3) + 8 >= (pic_height>>1); |
1734 } | 1734 } |
1735 src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize; | 1735 src_cb= pic->data[1] + (mx>>3) + (my>>3)*h->mb_uvlinesize; |
1736 src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; | 1736 src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; |
1737 | 1737 |
2762 if (is_complex) | 2762 if (is_complex) |
2763 hl_decode_mb_complex(h); | 2763 hl_decode_mb_complex(h); |
2764 else hl_decode_mb_simple(h); | 2764 else hl_decode_mb_simple(h); |
2765 } | 2765 } |
2766 | 2766 |
2767 static void pic_as_field(Picture *pic, const int bottom){ | 2767 static void pic_as_field(Picture *pic, const int parity){ |
2768 int i; | 2768 int i; |
2769 for (i = 0; i < 4; ++i) { | 2769 for (i = 0; i < 4; ++i) { |
2770 if (bottom) | 2770 if (parity == PICT_BOTTOM_FIELD) |
2771 pic->data[i] += pic->linesize[i]; | 2771 pic->data[i] += pic->linesize[i]; |
2772 pic->reference = parity; | |
2772 pic->linesize[i] *= 2; | 2773 pic->linesize[i] *= 2; |
2773 } | 2774 } |
2774 } | 2775 } |
2775 | 2776 |
2776 static int split_field_copy(Picture *dest, Picture *src, | 2777 static int split_field_copy(Picture *dest, Picture *src, |
2777 int parity, int id_add){ | 2778 int parity, int id_add){ |
2778 int match = !!(src->reference & parity); | 2779 int match = !!(src->reference & parity); |
2779 | 2780 |
2780 if (match) { | 2781 if (match) { |
2781 *dest = *src; | 2782 *dest = *src; |
2782 pic_as_field(dest, parity == PICT_BOTTOM_FIELD); | 2783 pic_as_field(dest, parity); |
2783 dest->pic_id *= 2; | 2784 dest->pic_id *= 2; |
2784 dest->pic_id += id_add; | 2785 dest->pic_id += id_add; |
2785 } | 2786 } |
2786 | 2787 |
2787 return match; | 2788 return match; |
3131 for(; i > index; i--){ | 3132 for(; i > index; i--){ |
3132 h->ref_list[list][i]= h->ref_list[list][i-1]; | 3133 h->ref_list[list][i]= h->ref_list[list][i-1]; |
3133 } | 3134 } |
3134 h->ref_list[list][index]= *ref; | 3135 h->ref_list[list][index]= *ref; |
3135 if (FIELD_PICTURE){ | 3136 if (FIELD_PICTURE){ |
3136 int bot = pic_structure == PICT_BOTTOM_FIELD; | 3137 pic_as_field(&h->ref_list[list][index], pic_structure); |
3137 pic_as_field(&h->ref_list[list][index], bot); | |
3138 } | 3138 } |
3139 } | 3139 } |
3140 }else{ | 3140 }else{ |
3141 av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); | 3141 av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); |
3142 return -1; | 3142 return -1; |
3164 Picture *frame = &h->ref_list[list][i]; | 3164 Picture *frame = &h->ref_list[list][i]; |
3165 Picture *field = &h->ref_list[list][16+2*i]; | 3165 Picture *field = &h->ref_list[list][16+2*i]; |
3166 field[0] = *frame; | 3166 field[0] = *frame; |
3167 for(j=0; j<3; j++) | 3167 for(j=0; j<3; j++) |
3168 field[0].linesize[j] <<= 1; | 3168 field[0].linesize[j] <<= 1; |
3169 field[0].reference = PICT_TOP_FIELD; | |
3169 field[1] = field[0]; | 3170 field[1] = field[0]; |
3170 for(j=0; j<3; j++) | 3171 for(j=0; j<3; j++) |
3171 field[1].data[j] += frame->linesize[j]; | 3172 field[1].data[j] += frame->linesize[j]; |
3173 field[1].reference = PICT_BOTTOM_FIELD; | |
3172 | 3174 |
3173 h->luma_weight[list][16+2*i] = h->luma_weight[list][16+2*i+1] = h->luma_weight[list][i]; | 3175 h->luma_weight[list][16+2*i] = h->luma_weight[list][16+2*i+1] = h->luma_weight[list][i]; |
3174 h->luma_offset[list][16+2*i] = h->luma_offset[list][16+2*i+1] = h->luma_offset[list][i]; | 3176 h->luma_offset[list][16+2*i] = h->luma_offset[list][16+2*i+1] = h->luma_offset[list][i]; |
3175 for(j=0; j<2; j++){ | 3177 for(j=0; j<2; j++){ |
3176 h->chroma_weight[list][16+2*i][j] = h->chroma_weight[list][16+2*i+1][j] = h->chroma_weight[list][i][j]; | 3178 h->chroma_weight[list][16+2*i][j] = h->chroma_weight[list][16+2*i+1][j] = h->chroma_weight[list][i][j]; |