avcodec/svq3: Don't copy watermarked frame data twice
The SVQ3 decoder modifies the input bitstream at two places. One of them is only reached when the file is watermarked. Therefore commit2264c11081
made a copy of all the frame data in this case. But there is a second possibility for modifying the frame and therefore Libav commit1098f5c049
made the decoder always copy the data. This of course makes the additional copy for watermarked frames redundant, but it hasn't been removed. This commit does so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
3ab1a890e8
commit
bcf707639e
|
@ -97,8 +97,6 @@ typedef struct SVQ3Context {
|
|||
int thirdpel_flag;
|
||||
int has_watermark;
|
||||
uint32_t watermark_key;
|
||||
uint8_t *buf;
|
||||
int buf_size;
|
||||
int adaptive_quant;
|
||||
int next_p_frame_damaged;
|
||||
int h_edge_pos;
|
||||
|
@ -1383,7 +1381,6 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
|||
SVQ3Context *s = avctx->priv_data;
|
||||
int buf_size = avpkt->size;
|
||||
int left;
|
||||
uint8_t *buf;
|
||||
int ret, m, i;
|
||||
|
||||
/* special case for last picture */
|
||||
|
@ -1400,17 +1397,7 @@ static int svq3_decode_frame(AVCodecContext *avctx, void *data,
|
|||
|
||||
s->mb_x = s->mb_y = s->mb_xy = 0;
|
||||
|
||||
if (s->watermark_key) {
|
||||
av_fast_padded_malloc(&s->buf, &s->buf_size, buf_size);
|
||||
if (!s->buf)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(s->buf, avpkt->data, buf_size);
|
||||
buf = s->buf;
|
||||
} else {
|
||||
buf = avpkt->data;
|
||||
}
|
||||
|
||||
ret = init_get_bits(&s->gb, buf, 8 * buf_size);
|
||||
ret = init_get_bits8(&s->gb, avpkt->data, avpkt->size);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -1611,10 +1598,6 @@ static av_cold int svq3_decode_end(AVCodecContext *avctx)
|
|||
av_freep(&s->edge_emu_buffer);
|
||||
av_freep(&s->mb2br_xy);
|
||||
|
||||
|
||||
av_freep(&s->buf);
|
||||
s->buf_size = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user