X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fulti.c;h=186f1a636aeda1b510c6ee7153a16d3dbe3b6ed2;hb=b452d5ae866942cec00aa1432fe29498b38b49fc;hp=3825980cfbbfade16c8a9f169dcf870b1387e6cf;hpb=3b199d29cd597a3518136d78860e172060b9e83d;p=ffmpeg diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index 3825980cfbb..186f1a636ae 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -37,7 +37,7 @@ typedef struct UltimotionDecodeContext { AVCodecContext *avctx; int width, height, blocks; - AVFrame frame; + AVFrame *frame; const uint8_t *ulti_codebook; GetByteContext gb; } UltimotionDecodeContext; @@ -51,18 +51,19 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx) s->height = avctx->height; s->blocks = (s->width / 8) * (s->height / 8); avctx->pix_fmt = AV_PIX_FMT_YUV410P; - avctx->coded_frame = &s->frame; s->ulti_codebook = ulti_codebook; - avcodec_get_frame_defaults(&s->frame); + + s->frame = av_frame_alloc(); + if (!s->frame) + return AVERROR(ENOMEM); return 0; } static av_cold int ulti_decode_end(AVCodecContext *avctx){ UltimotionDecodeContext *s = avctx->priv_data; - AVFrame *pic = &s->frame; - av_frame_unref(pic); + av_frame_free(&s->frame); return 0; } @@ -226,7 +227,7 @@ static int ulti_decode_frame(AVCodecContext *avctx, int skip; int tmp; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } @@ -369,7 +370,7 @@ static int ulti_decode_frame(AVCodecContext *avctx, Luma[14] = (tmp >> 6) & 0x3F; Luma[15] = tmp & 0x3F; - ulti_convert_yuv(&s->frame, tx, ty, Luma, chroma); + ulti_convert_yuv(s->frame, tx, ty, Luma, chroma); } else { if (bytestream2_get_bytes_left(&s->gb) < 4) goto err; @@ -381,20 +382,20 @@ static int ulti_decode_frame(AVCodecContext *avctx, Y[1] = tmp & 0x3F; Y[2] = bytestream2_get_byteu(&s->gb) & 0x3F; Y[3] = bytestream2_get_byteu(&s->gb) & 0x3F; - ulti_grad(&s->frame, tx, ty, Y, chroma, angle); //draw block + ulti_grad(s->frame, tx, ty, Y, chroma, angle); //draw block } else { // some patterns int f0, f1; f0 = bytestream2_get_byteu(&s->gb); f1 = tmp; Y[0] = bytestream2_get_byteu(&s->gb) & 0x3F; Y[1] = bytestream2_get_byteu(&s->gb) & 0x3F; - ulti_pattern(&s->frame, tx, ty, f1, f0, Y[0], Y[1], chroma); + ulti_pattern(s->frame, tx, ty, f1, f0, Y[0], Y[1], chroma); } } break; } if(code != 3) - ulti_grad(&s->frame, tx, ty, Y, chroma, angle); // draw block + ulti_grad(s->frame, tx, ty, Y, chroma, angle); // draw block } blocks++; x += 8; @@ -406,7 +407,7 @@ static int ulti_decode_frame(AVCodecContext *avctx, } *got_frame = 1; - if ((ret = av_frame_ref(data, &s->frame)) < 0) + if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; return buf_size; @@ -419,6 +420,7 @@ err: AVCodec ff_ulti_decoder = { .name = "ultimotion", + .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_ULTI, .priv_data_size = sizeof(UltimotionDecodeContext), @@ -426,5 +428,4 @@ AVCodec ff_ulti_decoder = { .close = ulti_decode_end, .decode = ulti_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"), };