Mercurial > libavcodec.hg
comparison msmpeg4.c @ 411:5c8b3a717929 libavcodec
workaround dc_scale bug in old ffmpeg msmpeg4v3 encoder (set workaround_bugs=1 for this)
author | michaelni |
---|---|
date | Tue, 21 May 2002 23:13:57 +0000 |
parents | fce0a2520551 |
children | 718a22dc121f |
comparison
equal
deleted
inserted
replaced
410:8aba98b353f0 | 411:5c8b3a717929 |
---|---|
13 * GNU General Public License for more details. | 13 * GNU General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU General Public License | 15 * You should have received a copy of the GNU General Public License |
16 * along with this program; if not, write to the Free Software | 16 * along with this program; if not, write to the Free Software |
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 * | |
19 * msmpeg4v2 stuff by Michael Niedermayer <michaelni@gmx.at> | |
18 */ | 20 */ |
19 #include "avcodec.h" | 21 #include "avcodec.h" |
20 #include "dsputil.h" | 22 #include "dsputil.h" |
21 #include "mpegvideo.h" | 23 #include "mpegvideo.h" |
24 | |
22 | 25 |
23 /* | 26 /* |
24 * You can also call this codec : MPEG4 with a twist ! | 27 * You can also call this codec : MPEG4 with a twist ! |
25 * | 28 * |
26 * TODO: | 29 * TODO: |
405 for (i = 0; i < 6; i++) { | 408 for (i = 0; i < 6; i++) { |
406 msmpeg4_encode_block(s, block[i], i); | 409 msmpeg4_encode_block(s, block[i], i); |
407 } | 410 } |
408 } | 411 } |
409 | 412 |
410 | 413 /* old ffmpeg msmpeg4v3 mode */ |
411 #if 0 | 414 void ff_old_msmpeg4_dc_scale(MpegEncContext * s) |
412 /* identical to mpeg4 for msmpeg4v3 but not msmpeg4v2 */ | 415 { |
413 void msmpeg4_dc_scale(MpegEncContext * s) | 416 if (s->qscale < 5){ |
414 { | |
415 if (s->qscale < 5 || s->msmpeg4_version==2){ | |
416 s->y_dc_scale = 8; | 417 s->y_dc_scale = 8; |
417 s->c_dc_scale = 8; | 418 s->c_dc_scale = 8; |
418 }else if (s->qscale < 9){ | 419 }else if (s->qscale < 9){ |
419 s->y_dc_scale = 2 * s->qscale; | 420 s->y_dc_scale = 2 * s->qscale; |
420 s->c_dc_scale = (s->qscale + 13)>>1; | 421 s->c_dc_scale = (s->qscale + 13)>>1; |
421 }else if(s->qscale < 25){ | 422 }else{ |
422 s->y_dc_scale = s->qscale + 8; | 423 s->y_dc_scale = s->qscale + 8; |
423 s->c_dc_scale = (s->qscale + 13)>>1; | 424 s->c_dc_scale = (s->qscale + 13)>>1; |
424 }else{ | 425 } |
425 s->y_dc_scale = 2 * s->qscale - 16; | 426 } |
426 s->c_dc_scale = s->qscale - 6; | |
427 } | |
428 } | |
429 #endif | |
430 | 427 |
431 /* dir = 0: left, dir = 1: top prediction */ | 428 /* dir = 0: left, dir = 1: top prediction */ |
432 static int msmpeg4_pred_dc(MpegEncContext * s, int n, | 429 static int msmpeg4_pred_dc(MpegEncContext * s, int n, |
433 INT16 **dc_val_ptr, int *dir_ptr) | 430 INT16 **dc_val_ptr, int *dir_ptr) |
434 { | 431 { |