aboutsummaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer2002-04-30 01:29:29 +0000
committerMichael Niedermayer2002-04-30 01:29:29 +0000
commitbb71e31757ada3017707a61fa74e71c18b5b6586 (patch)
treede5e4ac58cfe73467c0edd76bbdb04c2a89d2545 /libavcodec
parentbb3debab2cfa9e3e44273ea440cf39e5a872da6d (diff)
fixing msmpeg4v3 dc-scale for quantizers 24-31
Originally committed as revision 427 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263dec.c4
-rw-r--r--libavcodec/mpegvideo.c4
-rw-r--r--libavcodec/mpegvideo.h1
-rw-r--r--libavcodec/msmpeg4.c9
4 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index ebd8ff279c..1ab17b190b 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -199,9 +199,7 @@ static int h263_decode_frame(AVCodecContext *avctx,
#endif
//fprintf(stderr,"\nFrame: %d\tMB: %d",avctx->frame_number, (s->mb_y * s->mb_width) + s->mb_x);
/* DCT & quantize */
- if (s->h263_msmpeg4) {
- msmpeg4_dc_scale(s);
- } else if (s->h263_pred) {
+ if (s->h263_pred && s->msmpeg4_version!=2) {
h263_dc_scale(s);
} else {
/* default quantization values */
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 37fb97e68a..8b0f4f138f 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1439,9 +1439,7 @@ static void encode_mb(MpegEncContext *s, int motion_x, int motion_y)
}
#endif
/* DCT & quantize */
- if (s->h263_msmpeg4) {
- msmpeg4_dc_scale(s);
- } else if (s->h263_pred) {
+ if (s->h263_pred && s->msmpeg4_version!=2) {
h263_dc_scale(s);
} else {
/* default quantization values */
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 962e0c54ca..33da18ee07 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -490,7 +490,6 @@ void msmpeg4_encode_ext_header(MpegEncContext * s);
void msmpeg4_encode_mb(MpegEncContext * s,
DCTELEM block[6][64],
int motion_x, int motion_y);
-void msmpeg4_dc_scale(MpegEncContext * s);
int msmpeg4_decode_picture_header(MpegEncContext * s);
int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
int msmpeg4_decode_mb(MpegEncContext *s,
diff --git a/libavcodec/msmpeg4.c b/libavcodec/msmpeg4.c
index 188e2302f6..4321071f22 100644
--- a/libavcodec/msmpeg4.c
+++ b/libavcodec/msmpeg4.c
@@ -411,7 +411,8 @@ void msmpeg4_encode_mb(MpegEncContext * s,
}
-/* strongly inspirated from MPEG4, but not exactly the same ! */
+#if 0
+/* identical to mpeg4 for msmpeg4v3 but not msmpeg4v2 */
void msmpeg4_dc_scale(MpegEncContext * s)
{
if (s->qscale < 5 || s->msmpeg4_version==2){
@@ -420,11 +421,15 @@ void msmpeg4_dc_scale(MpegEncContext * s)
}else if (s->qscale < 9){
s->y_dc_scale = 2 * s->qscale;
s->c_dc_scale = (s->qscale + 13)>>1;
- }else{
+ }else if(s->qscale < 25){
s->y_dc_scale = s->qscale + 8;
s->c_dc_scale = (s->qscale + 13)>>1;
+ }else{
+ s->y_dc_scale = 2 * s->qscale - 16;
+ s->c_dc_scale = s->qscale - 6;
}
}
+#endif
/* dir = 0: left, dir = 1: top prediction */
static int msmpeg4_pred_dc(MpegEncContext * s, int n,