Mercurial > libavcodec.hg
comparison mpegvideo.c @ 591:d3f374218030 libavcodec
fixing mpeg4 mpeg quantizers
author | michaelni |
---|---|
date | Fri, 02 Aug 2002 20:27:46 +0000 |
parents | 9e271424160f |
children | 909e50c67d0e |
comparison
equal
deleted
inserted
replaced
590:3f8824eb4690 | 591:d3f374218030 |
---|---|
135 MPV_common_init_mmx(s); | 135 MPV_common_init_mmx(s); |
136 #endif | 136 #endif |
137 #ifdef ARCH_ALPHA | 137 #ifdef ARCH_ALPHA |
138 MPV_common_init_axp(s); | 138 MPV_common_init_axp(s); |
139 #endif | 139 #endif |
140 //setup default unquantizers (mpeg4 might change it later) | 140 |
141 if(s->out_format == FMT_H263) | |
142 s->dct_unquantize = s->dct_unquantize_h263; | |
143 else | |
144 s->dct_unquantize = s->dct_unquantize_mpeg1; | |
145 | |
146 s->mb_width = (s->width + 15) / 16; | 141 s->mb_width = (s->width + 15) / 16; |
147 s->mb_height = (s->height + 15) / 16; | 142 s->mb_height = (s->height + 15) / 16; |
148 | 143 |
149 /* set default edge pos, will be overriden in decode_header if needed */ | 144 /* set default edge pos, will be overriden in decode_header if needed */ |
150 s->h_edge_pos= s->mb_width*16; | 145 s->h_edge_pos= s->mb_width*16; |
669 avctx->dr_opaque_frame= s->last_dr_opaque; | 664 avctx->dr_opaque_frame= s->last_dr_opaque; |
670 else | 665 else |
671 avctx->dr_opaque_frame= s->next_dr_opaque; | 666 avctx->dr_opaque_frame= s->next_dr_opaque; |
672 } | 667 } |
673 } | 668 } |
669 | |
670 /* set dequantizer, we cant do it during init as it might change for mpeg4 | |
671 and we cant do it in the header decode as init isnt called for mpeg4 there yet */ | |
672 if(s->out_format == FMT_H263){ | |
673 if(s->mpeg_quant) | |
674 s->dct_unquantize = s->dct_unquantize_mpeg2; | |
675 else | |
676 s->dct_unquantize = s->dct_unquantize_h263; | |
677 }else | |
678 s->dct_unquantize = s->dct_unquantize_mpeg1; | |
674 } | 679 } |
675 | 680 |
676 /* generic function for encode/decode called after a frame has been coded/decoded */ | 681 /* generic function for encode/decode called after a frame has been coded/decoded */ |
677 void MPV_frame_end(MpegEncContext *s) | 682 void MPV_frame_end(MpegEncContext *s) |
678 { | 683 { |
1511 | 1516 |
1512 /* skip dequant / idct if we are really late ;) */ | 1517 /* skip dequant / idct if we are really late ;) */ |
1513 if(s->hurry_up>1) goto the_end; | 1518 if(s->hurry_up>1) goto the_end; |
1514 | 1519 |
1515 /* add dct residue */ | 1520 /* add dct residue */ |
1516 if(s->encoding || !(s->mpeg2 || s->h263_msmpeg4 || s->codec_id==CODEC_ID_MPEG4)){ | 1521 if(s->encoding || !(s->mpeg2 || s->h263_msmpeg4 || (s->codec_id==CODEC_ID_MPEG4 && !s->mpeg_quant))){ |
1517 add_dequant_dct(s, block[0], 0, dest_y, dct_linesize); | 1522 add_dequant_dct(s, block[0], 0, dest_y, dct_linesize); |
1518 add_dequant_dct(s, block[1], 1, dest_y + 8, dct_linesize); | 1523 add_dequant_dct(s, block[1], 1, dest_y + 8, dct_linesize); |
1519 add_dequant_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize); | 1524 add_dequant_dct(s, block[2], 2, dest_y + dct_offset, dct_linesize); |
1520 add_dequant_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize); | 1525 add_dequant_dct(s, block[3], 3, dest_y + dct_offset + 8, dct_linesize); |
1521 | 1526 |