Mercurial > libavcodec.hg
changeset 216:f8802ed5332b libavcodec
(commit by michael)
quantizer range bugfix (mpeg1 & mpeg4 encoding)
author | arpi_esp |
---|---|
date | Thu, 24 Jan 2002 14:34:03 +0000 |
parents | 1fe6b64feefb |
children | de372d04039c |
files | mpegvideo.c |
diffstat | 1 files changed, 38 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mpegvideo.c Mon Jan 21 17:46:42 2002 +0000 +++ b/mpegvideo.c Thu Jan 24 14:34:03 2002 +0000 @@ -1066,6 +1066,21 @@ { int i, j, level, last_non_zero, q; const int *qmat; + int minLevel, maxLevel; + + if(s->avctx!=NULL && s->avctx->codec->id==CODEC_ID_MPEG4){ + /* mpeg4 */ + minLevel= -2048; + maxLevel= 2047; + }else if(s->out_format==FMT_MPEG1){ + /* mpeg1 */ + minLevel= -255; + maxLevel= 255; + }else{ + /* h263 / msmpeg4 */ + minLevel= -128; + maxLevel= 127; + } av_fdct (block); @@ -1138,10 +1153,10 @@ h263: -128..127 mpeg4: -2048..2047 */ - if (level > 127) - level = 127; - else if (level < -128) - level = -128; + if (level > maxLevel) + level = maxLevel; + else if (level < minLevel) + level = minLevel; block[j] = level; last_non_zero = i; } else { @@ -1157,6 +1172,21 @@ { int i, j, level, last_non_zero, q; const int *qmat; + int minLevel, maxLevel; + + if(s->avctx!=NULL && s->avctx->codec->id==CODEC_ID_MPEG4){ + /* mpeg4 */ + minLevel= -2048; + maxLevel= 2047; + }else if(s->out_format==FMT_MPEG1){ + /* mpeg1 */ + minLevel= -255; + maxLevel= 255; + }else{ + /* h263 / msmpeg4 */ + minLevel= -128; + maxLevel= 127; + } av_fdct (block); @@ -1202,10 +1232,10 @@ h263: -128..127 mpeg4: -2048..2047 */ - if (level > 127) - level = 127; - else if (level < -128) - level = -128; + if (level > maxLevel) + level = maxLevel; + else if (level < minLevel) + level = minLevel; block[j] = level; last_non_zero = i; } else {