Commit 6d70639c authored by Anton Khirnov's avatar Anton Khirnov

mjpegenc: do not pass MpegEncContext to jpeg_table_header()

Pass the three needed fields from it directly.
This will allow to deMpegEncContextize the LJPEG encoder.
parent e1eaaec7
...@@ -96,9 +96,9 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id, ...@@ -96,9 +96,9 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
return n + 17; return n + 17;
} }
static void jpeg_table_header(MpegEncContext *s) static void jpeg_table_header(PutBitContext *p, ScanTable *intra_scantable,
uint16_t intra_matrix[64])
{ {
PutBitContext *p = &s->pb;
int i, j, size; int i, j, size;
uint8_t *ptr; uint8_t *ptr;
...@@ -108,8 +108,8 @@ static void jpeg_table_header(MpegEncContext *s) ...@@ -108,8 +108,8 @@ static void jpeg_table_header(MpegEncContext *s)
put_bits(p, 4, 0); /* 8 bit precision */ put_bits(p, 4, 0); /* 8 bit precision */
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 = s->intra_scantable.permutated[i]; j = intra_scantable->permutated[i];
put_bits(p, 8, s->intra_matrix[j]); put_bits(p, 8, intra_matrix[j]);
} }
/* huffman table */ /* huffman table */
...@@ -180,7 +180,7 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s) ...@@ -180,7 +180,7 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
jpeg_put_comments(s->avctx, &s->pb); jpeg_put_comments(s->avctx, &s->pb);
jpeg_table_header(s); jpeg_table_header(&s->pb, &s->intra_scantable, s->intra_matrix);
switch(s->avctx->codec_id){ switch(s->avctx->codec_id){
case AV_CODEC_ID_MJPEG: put_marker(&s->pb, SOF0 ); break; case AV_CODEC_ID_MJPEG: put_marker(&s->pb, SOF0 ); break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment