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.
pull/48/merge
Anton Khirnov 11 years ago
parent e1eaaec765
commit 6d70639c7d
  1. 10
      libavcodec/mjpegenc.c

@ -96,9 +96,9 @@ static int put_huffman_table(PutBitContext *p, int table_class, int table_id,
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;
uint8_t *ptr;
@ -108,8 +108,8 @@ static void jpeg_table_header(MpegEncContext *s)
put_bits(p, 4, 0); /* 8 bit precision */
put_bits(p, 4, 0); /* table 0 */
for(i=0;i<64;i++) {
j = s->intra_scantable.permutated[i];
put_bits(p, 8, s->intra_matrix[j]);
j = intra_scantable->permutated[i];
put_bits(p, 8, intra_matrix[j]);
}
/* huffman table */
@ -180,7 +180,7 @@ void ff_mjpeg_encode_picture_header(MpegEncContext *s)
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){
case AV_CODEC_ID_MJPEG: put_marker(&s->pb, SOF0 ); break;

Loading…
Cancel
Save