summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-01-11 21:26:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-01-11 21:26:51 +0100
commit859d74040e4b56b605abe92b00c0060b48eee73a (patch)
tree608d2b9854dce82d34891a350be62b36cdfee0f4
parent419787a2ffe31c6c70e542aae8c93c00f3aeb237 (diff)
avcodec/mjpegenc: pass chroma quantization matrix through as well, not just luma
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/ljpegenc.c2
-rw-r--r--libavcodec/mjpegenc.c14
-rw-r--r--libavcodec/mjpegenc.h3
-rw-r--r--libavcodec/mpegvideo_enc.c2
4 files changed, 12 insertions, 9 deletions
diff --git a/libavcodec/ljpegenc.c b/libavcodec/ljpegenc.c
index 35b82fdea2..b7e3d358c7 100644
--- a/libavcodec/ljpegenc.c
+++ b/libavcodec/ljpegenc.c
@@ -233,7 +233,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
init_put_bits(&pb, pkt->data, pkt->size);
ff_mjpeg_encode_picture_header(avctx, &pb, &s->scantable,
- s->matrix);
+ s->matrix, s->matrix);
header_bits = put_bits_count(&pb);
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 518a7d56a4..bf3e2571d6 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -108,7 +108,8 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
ScanTable *intra_scantable,
- uint16_t intra_matrix[64],
+ uint16_t luma_intra_matrix[64],
+ uint16_t chroma_intra_matrix[64],
int hsample[3])
{
int i, j, size;
@@ -126,14 +127,14 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
put_bits(p, 4, 0); /* table 0 */
for(i=0;i<64;i++) {
j = intra_scantable->permutated[i];
- put_bits(p, 8, intra_matrix[j]);
+ put_bits(p, 8, luma_intra_matrix[j]);
}
#ifdef TWOMATRIXES
put_bits(p, 4, 0); /* 8 bit precision */
put_bits(p, 4, 1); /* table 1 */
for(i=0;i<64;i++) {
- j = s->intra_scantable.permutated[i];
- put_bits(p, 8, s->chroma_intra_matrix[j]);
+ j = intra_scantable->permutated[i];
+ put_bits(p, 8, chroma_intra_matrix[j]);
}
#endif
}
@@ -232,7 +233,8 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
ScanTable *intra_scantable,
- uint16_t intra_matrix[64])
+ uint16_t luma_intra_matrix[64],
+ uint16_t chroma_intra_matrix[64])
{
const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG && avctx->codec_id != AV_CODEC_ID_AMV;
int hsample[3], vsample[3];
@@ -247,7 +249,7 @@ void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
jpeg_put_comments(avctx, pb);
- jpeg_table_header(avctx, pb, intra_scantable, intra_matrix, hsample);
+ jpeg_table_header(avctx, pb, intra_scantable, luma_intra_matrix, chroma_intra_matrix, hsample);
switch (avctx->codec_id) {
case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break;
diff --git a/libavcodec/mjpegenc.h b/libavcodec/mjpegenc.h
index 4b19e214d8..c5b05b511b 100644
--- a/libavcodec/mjpegenc.h
+++ b/libavcodec/mjpegenc.h
@@ -53,7 +53,8 @@ int ff_mjpeg_encode_init(MpegEncContext *s);
void ff_mjpeg_encode_close(MpegEncContext *s);
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
ScanTable *intra_scantable,
- uint16_t intra_matrix[64]);
+ uint16_t luma_intra_matrix[64],
+ uint16_t chroma_intra_matrix[64]);
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 09f96e4253..105f2cdfaa 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3548,7 +3548,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
case FMT_MJPEG:
if (CONFIG_MJPEG_ENCODER)
ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
- s->intra_matrix);
+ s->intra_matrix, s->chroma_intra_matrix);
break;
case FMT_H261:
if (CONFIG_H261_ENCODER)