aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-01-11 21:27:04 +0000
committerArpi <arpi@thot.banki.hu>2002-01-11 21:27:04 +0000
commit6fb904ce304b016a6945f17cf8065637fb1cbfa9 (patch)
treea54dd6abfdbbce0c90a398f5c9bd45c4629af9f7 /libavcodec
parent477c35a9f0bc69dae5891d7380191ca541001613 (diff)
downloadffmpeg-6fb904ce304b016a6945f17cf8065637fb1cbfa9.tar.gz
s->c_dc_scale was 7 if s->qscale==2 but should be 8 (the bug is visible in deep red areas in high bitrate clips) - patch by Michael Niedermayer <michaelni@gmx.at>
Originally committed as revision 255 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/msmpeg4.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 962bd1823a..9a2cb53ff8 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -347,16 +347,35 @@ void msmpeg4_encode_mb(MpegEncContext * s,
/* strongly inspirated from MPEG4, but not exactly the same ! */
void msmpeg4_dc_scale(MpegEncContext * s)
{
- int scale;
-
- if (s->qscale < 5)
- scale = 8;
- else if (s->qscale < 9)
- scale = 2 * s->qscale;
- else
- scale = s->qscale + 8;
- s->y_dc_scale = scale;
- s->c_dc_scale = (s->qscale + 13) / 2;
+ if (s->qscale < 5){
+ s->y_dc_scale = 8;
+ s->c_dc_scale = 8;
+// s->c_dc_scale = (s->qscale + 13)>>1;
+ }else if (s->qscale < 9){
+ s->y_dc_scale = 2 * s->qscale;
+ s->c_dc_scale = (s->qscale + 13)>>1;
+ }else{
+ s->y_dc_scale = s->qscale + 8;
+ s->c_dc_scale = (s->qscale + 13)>>1;
+ }
+ // this differs for quant >24 from mpeg4
+
+// if(s->qscale==13) s->c_dc_scale=14;
+
+// if(s->qscale>=6)
+// printf("%d", s->qscale);
+
+ /* s->c_dc_scale values (found by Michael Nidermayer)
+ qscale=2 -> 8 (yes iam sure about that)
+ qscale=3 -> 8
+ qscale=4 -> 8
+ qscale=5 -> 9
+ qscale=6 -> 9
+ qscale=7 -> 10
+ qscale=8 -> 10
+ qscale=9 -> 11
+ qscale=10-> 11
+ */
}
/* dir = 0: left, dir = 1: top prediction */