mirror of https://git.ffmpeg.org/ffmpeg.git
avcodec/mjpegenc: pass chroma quantization matrix through as well, not just luma
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
419787a2ff
commit
859d74040e
|
@ -233,7 +233,7 @@ static int ljpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||||
init_put_bits(&pb, pkt->data, pkt->size);
|
init_put_bits(&pb, pkt->data, pkt->size);
|
||||||
|
|
||||||
ff_mjpeg_encode_picture_header(avctx, &pb, &s->scantable,
|
ff_mjpeg_encode_picture_header(avctx, &pb, &s->scantable,
|
||||||
s->matrix);
|
s->matrix, s->matrix);
|
||||||
|
|
||||||
header_bits = put_bits_count(&pb);
|
header_bits = put_bits_count(&pb);
|
||||||
|
|
||||||
|
|
|
@ -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,
|
static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
|
||||||
ScanTable *intra_scantable,
|
ScanTable *intra_scantable,
|
||||||
uint16_t intra_matrix[64],
|
uint16_t luma_intra_matrix[64],
|
||||||
|
uint16_t chroma_intra_matrix[64],
|
||||||
int hsample[3])
|
int hsample[3])
|
||||||
{
|
{
|
||||||
int i, j, size;
|
int i, j, size;
|
||||||
|
@ -126,14 +127,14 @@ static void jpeg_table_header(AVCodecContext *avctx, PutBitContext *p,
|
||||||
put_bits(p, 4, 0); /* table 0 */
|
put_bits(p, 4, 0); /* table 0 */
|
||||||
for(i=0;i<64;i++) {
|
for(i=0;i<64;i++) {
|
||||||
j = intra_scantable->permutated[i];
|
j = intra_scantable->permutated[i];
|
||||||
put_bits(p, 8, intra_matrix[j]);
|
put_bits(p, 8, luma_intra_matrix[j]);
|
||||||
}
|
}
|
||||||
#ifdef TWOMATRIXES
|
#ifdef TWOMATRIXES
|
||||||
put_bits(p, 4, 0); /* 8 bit precision */
|
put_bits(p, 4, 0); /* 8 bit precision */
|
||||||
put_bits(p, 4, 1); /* table 1 */
|
put_bits(p, 4, 1); /* table 1 */
|
||||||
for(i=0;i<64;i++) {
|
for(i=0;i<64;i++) {
|
||||||
j = s->intra_scantable.permutated[i];
|
j = intra_scantable->permutated[i];
|
||||||
put_bits(p, 8, s->chroma_intra_matrix[j]);
|
put_bits(p, 8, chroma_intra_matrix[j]);
|
||||||
}
|
}
|
||||||
#endif
|
#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,
|
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
||||||
ScanTable *intra_scantable,
|
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;
|
const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG && avctx->codec_id != AV_CODEC_ID_AMV;
|
||||||
int hsample[3], vsample[3];
|
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_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) {
|
switch (avctx->codec_id) {
|
||||||
case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break;
|
case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break;
|
||||||
|
|
|
@ -53,7 +53,8 @@ int ff_mjpeg_encode_init(MpegEncContext *s);
|
||||||
void ff_mjpeg_encode_close(MpegEncContext *s);
|
void ff_mjpeg_encode_close(MpegEncContext *s);
|
||||||
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb,
|
||||||
ScanTable *intra_scantable,
|
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_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
||||||
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
void ff_mjpeg_escape_FF(PutBitContext *pb, int start);
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||||
|
|
|
@ -3548,7 +3548,7 @@ static int encode_picture(MpegEncContext *s, int picture_number)
|
||||||
case FMT_MJPEG:
|
case FMT_MJPEG:
|
||||||
if (CONFIG_MJPEG_ENCODER)
|
if (CONFIG_MJPEG_ENCODER)
|
||||||
ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
|
ff_mjpeg_encode_picture_header(s->avctx, &s->pb, &s->intra_scantable,
|
||||||
s->intra_matrix);
|
s->intra_matrix, s->chroma_intra_matrix);
|
||||||
break;
|
break;
|
||||||
case FMT_H261:
|
case FMT_H261:
|
||||||
if (CONFIG_H261_ENCODER)
|
if (CONFIG_H261_ENCODER)
|
||||||
|
|
Loading…
Reference in New Issue