mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '3360ad995530ea6967b1e83981b4aa8240fbb0ed'
* commit '3360ad995530ea6967b1e83981b4aa8240fbb0ed': mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_picture_trailer() Conflicts: libavcodec/ljpegenc.c libavcodec/mjpegenc.c libavcodec/mjpegenc.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
b342ea603f
@ -210,8 +210,9 @@ static int encode_picture_lossless(AVCodecContext *avctx, AVPacket *pkt,
|
|||||||
|
|
||||||
emms_c();
|
emms_c();
|
||||||
av_assert0(s->esc_pos == s->header_bits >> 3);
|
av_assert0(s->esc_pos == s->header_bits >> 3);
|
||||||
|
|
||||||
ff_mjpeg_encode_stuffing(s);
|
ff_mjpeg_encode_stuffing(s);
|
||||||
ff_mjpeg_encode_picture_trailer(s);
|
ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
|
||||||
s->picture_number++;
|
s->picture_number++;
|
||||||
|
|
||||||
flush_put_bits(&s->pb);
|
flush_put_bits(&s->pb);
|
||||||
|
@ -324,11 +324,11 @@ end:
|
|||||||
s->thread_context[i]->esc_pos = 0;
|
s->thread_context[i]->esc_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void escape_FF(MpegEncContext *s, int start)
|
static void escape_FF(PutBitContext *pb, int start)
|
||||||
{
|
{
|
||||||
int size= put_bits_count(&s->pb) - start*8;
|
int size = put_bits_count(pb) - start * 8;
|
||||||
int i, ff_count;
|
int i, ff_count;
|
||||||
uint8_t *buf= s->pb.buf + start;
|
uint8_t *buf = pb->buf + start;
|
||||||
int align= (-(size_t)(buf))&3;
|
int align= (-(size_t)(buf))&3;
|
||||||
|
|
||||||
av_assert1((size&7) == 0);
|
av_assert1((size&7) == 0);
|
||||||
@ -361,8 +361,8 @@ static void escape_FF(MpegEncContext *s, int start)
|
|||||||
|
|
||||||
if(ff_count==0) return;
|
if(ff_count==0) return;
|
||||||
|
|
||||||
flush_put_bits(&s->pb);
|
flush_put_bits(pb);
|
||||||
skip_put_bytes(&s->pb, ff_count);
|
skip_put_bytes(pb, ff_count);
|
||||||
|
|
||||||
for(i=size-1; ff_count; i--){
|
for(i=size-1; ff_count; i--){
|
||||||
int v= buf[i];
|
int v= buf[i];
|
||||||
@ -385,7 +385,7 @@ void ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
|||||||
if(length) put_bits(pbc, length, (1<<length)-1);
|
if(length) put_bits(pbc, length, (1<<length)-1);
|
||||||
|
|
||||||
flush_put_bits(&s->pb);
|
flush_put_bits(&s->pb);
|
||||||
escape_FF(s, s->esc_pos);
|
escape_FF(&s->pb, s->esc_pos);
|
||||||
|
|
||||||
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
if((s->avctx->active_thread_type & FF_THREAD_SLICE) && mb_y < s->mb_height)
|
||||||
put_marker(pbc, RST0 + (mb_y&7));
|
put_marker(pbc, RST0 + (mb_y&7));
|
||||||
@ -395,13 +395,11 @@ void ff_mjpeg_encode_stuffing(MpegEncContext *s)
|
|||||||
s->last_dc[i] = 128 << s->intra_dc_precision;
|
s->last_dc[i] = 128 << s->intra_dc_precision;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s)
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits)
|
||||||
{
|
{
|
||||||
|
av_assert1((header_bits & 7) == 0);
|
||||||
|
|
||||||
av_assert1((s->header_bits&7)==0);
|
put_marker(pb, EOI);
|
||||||
|
|
||||||
|
|
||||||
put_marker(&s->pb, EOI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||||
|
@ -54,7 +54,7 @@ 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 intra_matrix[64]);
|
||||||
void ff_mjpeg_encode_picture_trailer(MpegEncContext *s);
|
void ff_mjpeg_encode_picture_trailer(PutBitContext *pb, int header_bits);
|
||||||
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
void ff_mjpeg_encode_stuffing(MpegEncContext *s);
|
||||||
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
void ff_mjpeg_encode_dc(MpegEncContext *s, int val,
|
||||||
uint8_t *huff_size, uint16_t *huff_code);
|
uint8_t *huff_size, uint16_t *huff_code);
|
||||||
|
@ -1598,7 +1598,7 @@ vbv_retry:
|
|||||||
frame_end(s);
|
frame_end(s);
|
||||||
|
|
||||||
if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
|
if (CONFIG_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
|
||||||
ff_mjpeg_encode_picture_trailer(s);
|
ff_mjpeg_encode_picture_trailer(&s->pb, s->header_bits);
|
||||||
|
|
||||||
if (avctx->rc_buffer_size) {
|
if (avctx->rc_buffer_size) {
|
||||||
RateControlContext *rcc = &s->rc_context;
|
RateControlContext *rcc = &s->rc_context;
|
||||||
|
Loading…
Reference in New Issue
Block a user