diff options
Diffstat (limited to 'libavcodec/huffyuvdec.c')
-rw-r--r-- | libavcodec/huffyuvdec.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 159a517..8554ecf 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -256,7 +256,6 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_huffyuv_common_init(avctx); memset(s->vlc, 0, 3 * sizeof(VLC)); - avctx->coded_frame = &s->picture; avcodec_get_frame_defaults(&s->picture); s->interlaced = s->height > 288; @@ -364,7 +363,6 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx) HYuvContext *s = avctx->priv_data; int i; - avctx->coded_frame= &s->picture; if (ff_huffyuv_alloc_temp(s)) { ff_huffyuv_common_end(s); return AVERROR(ENOMEM); @@ -473,7 +471,7 @@ static void decode_bgr_bitstream(HYuvContext *s, int count) } } -static void draw_slice(HYuvContext *s, int y) +static void draw_slice(HYuvContext *s, AVFrame *frame, int y) { int h, cy, i; int offset[AV_NUM_DATA_POINTERS]; @@ -490,14 +488,14 @@ static void draw_slice(HYuvContext *s, int y) cy = y; } - offset[0] = s->picture.linesize[0]*y; - offset[1] = s->picture.linesize[1]*cy; - offset[2] = s->picture.linesize[2]*cy; + offset[0] = frame->linesize[0] * y; + offset[1] = frame->linesize[1] * cy; + offset[2] = frame->linesize[2] * cy; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; emms_c(); - s->avctx->draw_horiz_band(s->avctx, &s->picture, offset, y, 3, h); + s->avctx->draw_horiz_band(s->avctx, frame, offset, y, 3, h); s->last_slice_end = y + h; } @@ -512,11 +510,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, const int width2 = s->width>>1; const int height = s->height; int fake_ystride, fake_ustride, fake_vstride; - AVFrame * const p = &s->picture; + ThreadFrame frame = { .f = data }; + AVFrame * const p = data; int table_size = 0, ret; - AVFrame *picture = data; - av_fast_padded_malloc(&s->bitstream_buffer, &s->bitstream_buffer_size, buf_size); @@ -526,11 +523,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size / 4); - if (p->data[0]) - ff_thread_release_buffer(avctx, p); - - p->reference = 0; - if ((ret = ff_thread_get_buffer(avctx, p)) < 0) { + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -601,7 +594,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (y >= s->height) break; } - draw_slice(s, y); + draw_slice(s, p, y); ydst = p->data[0] + p->linesize[0]*y; udst = p->data[1] + p->linesize[1]*cy; @@ -623,7 +616,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } } } - draw_slice(s, height); + draw_slice(s, p, height); break; case MEDIAN: @@ -680,7 +673,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } if (y >= height) break; } - draw_slice(s, y); + draw_slice(s, p, y); decode_422_bitstream(s, width); @@ -695,7 +688,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } } - draw_slice(s, height); + draw_slice(s, p, height); break; } } @@ -739,7 +732,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } } // just 1 large slice as this is not possible in reverse order - draw_slice(s, height); + draw_slice(s, p, height); break; default: av_log(avctx, AV_LOG_ERROR, @@ -753,7 +746,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } emms_c(); - *picture = *p; *got_frame = 1; return (get_bits_count(&s->gb) + 31) / 32 * 4 + table_size; @@ -764,9 +756,6 @@ static av_cold int decode_end(AVCodecContext *avctx) HYuvContext *s = avctx->priv_data; int i; - if (s->picture.data[0]) - avctx->release_buffer(avctx, &s->picture); - ff_huffyuv_common_end(s); av_freep(&s->bitstream_buffer); |