aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2002-05-07 17:55:02 +0000
committerAlex Beregszaszi <alex@rtfs.hu>2002-05-07 17:55:02 +0000
commita69b930cd36503d80e7362f91493e306cd800aca (patch)
tree2fd8d915d27be65afe71a94ecb4edfcbec8d4da8 /libavcodec/mpegvideo.c
parent723106b279d9d78f5966f32bedfa33b88a702f69 (diff)
downloadffmpeg-a69b930cd36503d80e7362f91493e306cd800aca.tar.gz
clamp intra matrix to 8bit for mjpeg (workaround for qscale>=25)
Originally committed as revision 451 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 73daa0d323..19deb2da99 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -427,10 +427,11 @@ int MPV_encode_init(AVCodecContext *avctx)
s->out_format = FMT_MJPEG;
s->intra_only = 1; /* force intra only for jpeg */
s->mjpeg_write_tables = 1; /* write all tables */
+ s->mjpeg_data_only_frames = 0; /* write all the needed headers */
s->mjpeg_vsample[0] = 2; /* set up default sampling factors */
s->mjpeg_vsample[1] = 1; /* the only currently supported values */
s->mjpeg_vsample[2] = 1;
- s->mjpeg_hsample[0] = 2;
+ s->mjpeg_hsample[0] = 2;
s->mjpeg_hsample[1] = 1;
s->mjpeg_hsample[2] = 1;
if (mjpeg_init(s) < 0)
@@ -1658,7 +1659,7 @@ static void encode_picture(MpegEncContext *s, int picture_number)
/* for mjpeg, we do include qscale in the matrix */
s->intra_matrix[0] = default_intra_matrix[0];
for(i=1;i<64;i++)
- s->intra_matrix[i] = (default_intra_matrix[i] * s->qscale) >> 3;
+ s->intra_matrix[i] = CLAMP_TO_8BIT((default_intra_matrix[i] * s->qscale) >> 3);
convert_matrix(s->q_intra_matrix, s->q_intra_matrix16,
s->q_intra_matrix16_bias, s->intra_matrix, s->intra_quant_bias);
}