From patchwork Fri Mar 8 08:27:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 46892 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c995:b0:1a1:738b:6bc0 with SMTP id gy21csp798061pzb; Fri, 8 Mar 2024 00:28:14 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUUHTHZnqYHBJtBcGHqxO2OBr1Y/fe23hGBb7S2QjyvMNdimdLO81/cyyS8ZiF05wq88Bi34M4BAwM8OthX1k971Nucx76drH4WcA== X-Google-Smtp-Source: AGHT+IGjliUP/n7jpAyQG2pjsRsYqazi6nNu8P1Qog8/luoiHjK18bgH7xqjyCqJg8W8RorcJrc0 X-Received: by 2002:a50:c314:0:b0:565:ddc7:6dcd with SMTP id a20-20020a50c314000000b00565ddc76dcdmr1478622edb.8.1709886494189; Fri, 08 Mar 2024 00:28:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709886494; cv=none; d=google.com; s=arc-20160816; b=pu61kv5rQAIZJr69W+HZL7QjY9thDym2xCa3qzmDZsXzTsKhpS9ucpd4E9KSHdRNL8 6gOgyFzrG+zzCudiCbI7hHMWiEB1tn27wn/1b5eNvOGobG2f/NjosWy3cVScEv9InyYw /holIF3zVcLjWnYmYSu6O6r5+atB/I3YoIPUfdZ06F4Tma/iu2cU9Kxw8KclNGDf2FCs VWa+0Gq4FH0a8fitLFa0Mv+liM1XfSPj2kZjjvZL1u72K1wrZ6wvKdZA1IGZFzorG2op UJLLmrNm9Lodto1CSPQDtHwmntP3IbeEJEtySnWV3w9ySiJM4LbI9dhd78k2DvEoT0cG kJrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=CyyfKvvd5bCPBj+WjS3qzIZ12cxc5KrL54KJLKKHCnk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=NWRJp5afaT2+pGH03JoTSQG6Ps9zO3Z2uS6I7ysnqgveK85uoiPQFvZi6AXf3TDE+d GjqyJxqvttJt04bwhTKr1vo38DNCsfAnwdX03f1Z6pIEiy9T61gBEk0gt5QsS5Ubp7V7 KE+3oDYIIa+dM0mXpy2yyLNHhg/UVUQQnv6VC70GCs6utyjDrqS/2T7cXV+PRopg6W7H 2+sC1R7lDodTeQgEaZeAgEr2PmmxhMu5QiSMrnFxPxmj0XM++P4AzX9shfCrMb2grobN BZEAZ3JPuJW6xu+13fLcPR7jJOipcv6AARiSr447MrKs8a0xCwg3V+M1EIJM0rdNGLrO e5zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="hu/iW5aF"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id es20-20020a056402381400b005682ffbf30csi173535edb.380.2024.03.08.00.28.13; Fri, 08 Mar 2024 00:28:14 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b="hu/iW5aF"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B1DA668CD59; Fri, 8 Mar 2024 10:28:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9829B68C92E for ; Fri, 8 Mar 2024 10:27:53 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=hu/iW5aF; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 471604D4E for ; Fri, 8 Mar 2024 09:27:53 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id QVdQ-E55dFyp for ; Fri, 8 Mar 2024 09:27:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1709886471; bh=rTjTHrKndwzZXuWiymzukjmBM23Kgh1b6kuMxofRFVs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hu/iW5aFsHjp2WMUYsRqWHRLqCZAkfSgUuxk4aQ00VvuVKQlPU+axrFGjW8tYlE9g WAaU74bcHaU3MMtx/4ES2O6gnZx4IKSqQ8Egutj+Me4BvFaHug4+KQylY2YTBRAYkW U/bYcqVpcmA16UeXdudkn8RVPhnt0pih0v3MqY/FBpjW6GB0bj3ggs7bo52es35x/v wdrwXk4p3lHk9zkvJacWcQ3zafE+4bl9+4NAZcIb6fYsyHT3RQc45o5D/rpPuZ5ocI 9Sz7hw8dHaXNY50E8kI4HkWnkL715CD1VZOnj/fpWExMkWHJFUFzLVjngj7fYo6vJS aGJk8FkSxDg+Q== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 8ED43448A for ; Fri, 8 Mar 2024 09:27:51 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 691003A0582 for ; Fri, 8 Mar 2024 09:27:51 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Mar 2024 09:27:48 +0100 Message-ID: <20240308082749.20028-2-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240308082749.20028-1-anton@khirnov.net> References: <20240308082749.20028-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] lavc: replace ff_thread_get_buffer() with ff_get_buffer() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: cERI7nGtuuu+ ff_thread_get_buffer() has exactly the same semantics as ff_get_buffer(), except it is supposed to be used in frame-threaded decoders. Since the decoder instance knows whether frame threading is in use, there is no point in forcing decoder implementations to use a different function merely because they happen to support frame threading. --- libavcodec/aic.c | 4 ++-- libavcodec/alac.c | 4 ++-- libavcodec/av1dec.c | 2 +- libavcodec/avcodec_internal.h | 13 +++++++++++++ libavcodec/bitpacked_dec.c | 4 ++-- libavcodec/cfhd.c | 4 ++-- libavcodec/cllc.c | 8 ++++---- libavcodec/cri.c | 2 +- libavcodec/decode.c | 13 ++++++++++++- libavcodec/dnxhddec.c | 2 +- libavcodec/dvdec.c | 2 +- libavcodec/dxtory.c | 12 ++++++------ libavcodec/dxv.c | 4 ++-- libavcodec/exr.c | 2 +- libavcodec/flacdec.c | 4 ++-- libavcodec/fraps.c | 4 ++-- libavcodec/h264_slice.c | 2 +- libavcodec/hapdec.c | 4 ++-- libavcodec/hdrdec.c | 2 +- libavcodec/hevcdec.c | 2 +- libavcodec/hqx.c | 4 ++-- libavcodec/huffyuvdec.c | 4 ++-- libavcodec/jpeg2000dec.c | 2 +- libavcodec/lagarith.c | 12 ++++++------ libavcodec/lcldec.c | 4 ++-- libavcodec/magicyuv.c | 2 +- libavcodec/mdec.c | 4 ++-- libavcodec/notchlc.c | 2 +- libavcodec/photocd.c | 2 +- libavcodec/pixlet.c | 2 +- libavcodec/pngdec.c | 4 ++-- libavcodec/proresdec2.c | 2 +- libavcodec/pthread_frame.c | 7 ++----- libavcodec/qoidec.c | 2 +- libavcodec/rtv1.c | 2 +- libavcodec/sheervideo.c | 4 ++-- libavcodec/takdec.c | 5 +++-- libavcodec/thread.h | 10 ---------- libavcodec/tiff.c | 2 +- libavcodec/tta.c | 4 ++-- libavcodec/utils.c | 5 ----- libavcodec/utvideodec.c | 4 ++-- libavcodec/v210dec.c | 4 ++-- libavcodec/v410dec.c | 4 ++-- libavcodec/vaapi_av1.c | 4 ++-- libavcodec/vble.c | 4 ++-- libavcodec/vmixdec.c | 2 +- libavcodec/vvc/vvc_refs.c | 4 ++-- libavcodec/wbmpdec.c | 2 +- libavcodec/webp.c | 2 +- libavcodec/ylc.c | 4 ++-- 51 files changed, 110 insertions(+), 103 deletions(-) diff --git a/libavcodec/aic.c b/libavcodec/aic.c index f8b0f60354..b4b5089228 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -27,10 +27,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "golomb.h" #include "idctdsp.h" -#include "thread.h" #include "unary.h" #define AIC_HDR_SIZE 24 @@ -408,7 +408,7 @@ static int aic_decode_frame(AVCodecContext *avctx, AVFrame *frame, return ret; } - if ((ret = ff_thread_get_buffer(avctx, ctx->frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, ctx->frame, 0)) < 0) return ret; bytestream2_init(&gb, buf + AIC_HDR_SIZE, diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 538d1e5984..601d95a7f9 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -53,7 +53,7 @@ #include "get_bits.h" #include "bytestream.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #include "unary.h" #include "mathops.h" #include "alac_data.h" @@ -274,7 +274,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, if (!alac->nb_samples) { /* get output buffer */ frame->nb_samples = output_samples; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; } else if (output_samples != alac->nb_samples) { av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %"PRIu32" != %d\n", diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index bbb5634773..98ef1e1935 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -899,7 +899,7 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f) return ret; } - if ((ret = ff_thread_get_buffer(avctx, f->f, AV_GET_BUFFER_FLAG_REF)) < 0) + if ((ret = ff_get_buffer(avctx, f->f, AV_GET_BUFFER_FLAG_REF)) < 0) goto fail; frame = f->f; diff --git a/libavcodec/avcodec_internal.h b/libavcodec/avcodec_internal.h index e7a229dee9..48fc813a73 100644 --- a/libavcodec/avcodec_internal.h +++ b/libavcodec/avcodec_internal.h @@ -58,6 +58,19 @@ struct AVCodecInternal *ff_encode_internal_alloc(void); void ff_codec_close(struct AVCodecContext *avctx); +/** + * Wrapper around AVCodecContext.get_buffer2(), called from pthread_frame when + * frame threading is active, from the ff_get_buffer() otherwise. + */ +int ff_decode_get_buffer(struct AVCodecContext *avctx, struct AVFrame *frame, + int flags); +/** + * Wrapper around ff_decode_get_buffer() that will be called when frame + * threading is active. + */ +int ff_thread_get_buffer(struct AVCodecContext *avctx, struct AVFrame *frame, + int flags); + int ff_thread_init(struct AVCodecContext *s); void ff_thread_free(struct AVCodecContext *s); diff --git a/libavcodec/bitpacked_dec.c b/libavcodec/bitpacked_dec.c index 54c008bd86..4bd59b7d12 100644 --- a/libavcodec/bitpacked_dec.c +++ b/libavcodec/bitpacked_dec.c @@ -29,7 +29,7 @@ #include "avcodec.h" #include "codec_internal.h" #include "libavutil/imgutils.h" -#include "thread.h" +#include "decode.h" struct BitpackedContext { int (*decode)(AVCodecContext *avctx, AVFrame *frame, @@ -68,7 +68,7 @@ static int bitpacked_decode_yuv422p10(AVCodecContext *avctx, AVFrame *frame, uint16_t *y, *u, *v; int ret, i, j; - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 42d7dcc3f6..14301b829f 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -682,7 +682,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic, } pic->width = pic->height = 0; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; s->coded_width = 0; @@ -692,7 +692,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic, } else if (tag == FrameIndex && data == 1 && s->sample_type == 1 && s->frame_type == 2) { pic->width = pic->height = 0; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; s->coded_width = 0; s->coded_height = 0; diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index 0c6ae13d08..2c5dbcf53d 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -28,7 +28,7 @@ #include "get_bits.h" #include "avcodec.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #define VLC_BITS 7 #define VLC_DEPTH 2 @@ -422,7 +422,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_YUV422P; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_yuv_frame(ctx, &gb, pic); @@ -435,7 +435,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_RGB24; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_rgb24_frame(ctx, &gb, pic); @@ -447,7 +447,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, AVFrame *pic, avctx->pix_fmt = AV_PIX_FMT_ARGB; avctx->bits_per_raw_sample = 8; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; ret = decode_argb_frame(ctx, &gb, pic); diff --git a/libavcodec/cri.c b/libavcodec/cri.c index 990e52ac99..c54fb67cec 100644 --- a/libavcodec/cri.c +++ b/libavcodec/cri.c @@ -319,7 +319,7 @@ skip: if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; avctx->bits_per_raw_sample = bps; diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 4168cf6f2d..cdbbfd8ee2 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -1565,7 +1565,7 @@ int ff_attach_decode_data(AVFrame *frame) return 0; } -int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +int ff_decode_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); int override_dimensions = 1; @@ -1637,6 +1637,17 @@ fail: return ret; } +int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +{ +#if HAVE_THREADS + if (avctx->active_thread_type & FF_THREAD_FRAME) + return ff_thread_get_buffer(avctx, frame, flags); +#endif + av_assert0(!(avctx->active_thread_type & FF_THREAD_FRAME)); + + return ff_decode_get_buffer(avctx, frame, flags); +} + static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) { AVFrame *tmp; diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 703d0e341c..8e2bed5d83 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -652,7 +652,7 @@ decode_coding_unit: return ret; if (first_field) { - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) return ret; picture->pict_type = AV_PICTURE_TYPE_I; picture->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index f66a5f1a05..d6ecdda32b 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -668,7 +668,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, AVFrame *frame, ff_set_sar(avctx, s->sys->sar[is16_9]); } - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; /* Determine the codec's field order from the packet */ diff --git a/libavcodec/dxtory.c b/libavcodec/dxtory.c index f36420cdd9..2526b8e7b9 100644 --- a/libavcodec/dxtory.c +++ b/libavcodec/dxtory.c @@ -29,9 +29,9 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "unary.h" -#include "thread.h" static int64_t get_raw_size(enum AVPixelFormat fmt, int width, int height) { @@ -103,7 +103,7 @@ static int dxtory_decode_v1_rgb(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = id; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -136,7 +136,7 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV410P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -231,7 +231,7 @@ static int dxtory_decode_v1_420(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -301,7 +301,7 @@ static int dxtory_decode_v1_444(AVCodecContext *avctx, AVFrame *pic, } avctx->pix_fmt = AV_PIX_FMT_YUV444P; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); @@ -452,7 +452,7 @@ static int dxtory_decode_v2(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; avctx->pix_fmt = fmt; - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; do_vflip(avctx, pic, vflipped); diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index b5553a0c86..b4043553e9 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -28,10 +28,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "dxv.h" #include "lzf.h" #include "texturedsp.h" -#include "thread.h" typedef struct DXVContext { TextureDSPContext texdsp; @@ -1000,7 +1000,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, if (ret < 0) return ret; - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 5711fbbdcd..900e090c9a 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -2151,7 +2151,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, s->scan_lines_per_block; } - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) return ret; if (bytestream2_get_bytes_left(gb)/8 < nb_blocks) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index ed2de14d0a..bbdf6eab82 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -40,12 +40,12 @@ #include "codec_internal.h" #include "get_bits.h" #include "bytestream.h" +#include "decode.h" #include "golomb.h" #include "flac.h" #include "flacdata.h" #include "flacdsp.h" #include "flac_parse.h" -#include "thread.h" #include "unary.h" @@ -776,7 +776,7 @@ static int flac_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* get output buffer */ frame->nb_samples = s->blocksize; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; if (s->stream_info.bps == 32 && s->ch_mode > 0) { diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index bed244e4e9..6be0eecba4 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -41,7 +41,7 @@ #include "bytestream.h" #include "bswapdsp.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" #define FPS_TAG MKTAG('F', 'P', 'S', 'x') #define VLC_BITS 11 @@ -222,7 +222,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *f, : AVCOL_RANGE_JPEG; avctx->colorspace = version & 1 ? AVCOL_SPC_UNSPECIFIED : AVCOL_SPC_BT709; - if ((ret = ff_thread_get_buffer(avctx, f, 0)) < 0) + if ((ret = ff_get_buffer(avctx, f, 0)) < 0) return ret; switch (version) { diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index e9a404e41b..fc2c36485b 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -200,7 +200,7 @@ static int alloc_picture(H264Context *h, H264Picture *pic) pic->f_grain->format = pic->f->format; pic->f_grain->width = pic->f->width; pic->f_grain->height = pic->f->height; - ret = ff_thread_get_buffer(h->avctx, pic->f_grain, 0); + ret = ff_get_buffer(h->avctx, pic->f_grain, 0); if (ret < 0) goto fail; } diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 6066cb814c..9134069dcf 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -38,10 +38,10 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "hap.h" #include "snappy.h" #include "texturedsp.h" -#include "thread.h" static int hap_parse_decode_instructions(HapContext *ctx, int size) { @@ -271,7 +271,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame, } /* Get the output frame ready to receive data */ - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/hdrdec.c b/libavcodec/hdrdec.c index 9b6395bb6d..04838f259b 100644 --- a/libavcodec/hdrdec.c +++ b/libavcodec/hdrdec.c @@ -134,7 +134,7 @@ static int hdr_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; for (int y = 0; y < height; y++) { diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 76aa6b4588..bbc7683da6 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2901,7 +2901,7 @@ static int hevc_frame_start(HEVCContext *s) s->ref->frame_grain->format = s->ref->frame->format; s->ref->frame_grain->width = s->ref->frame->width; s->ref->frame_grain->height = s->ref->frame->height; - if ((ret = ff_thread_get_buffer(s->avctx, s->ref->frame_grain, 0)) < 0) + if ((ret = ff_get_buffer(s->avctx, s->ref->frame_grain, 0)) < 0) goto fail; } diff --git a/libavcodec/hqx.c b/libavcodec/hqx.c index 51099aa684..8398a79349 100644 --- a/libavcodec/hqx.c +++ b/libavcodec/hqx.c @@ -26,8 +26,8 @@ #include "avcodec.h" #include "canopus.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "hqx.h" #include "hqxdsp.h" @@ -498,7 +498,7 @@ static int hqx_decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index ce6d4d4c59..34f152f8ee 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -37,11 +37,11 @@ #include "avcodec.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "huffyuv.h" #include "huffyuvdsp.h" #include "lossless_videodsp.h" -#include "thread.h" #include "libavutil/emms.h" #include "libavutil/imgutils.h" #include "libavutil/pixdesc.h" @@ -1244,7 +1244,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer, (const uint32_t *) buf, buf_size / 4); - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (s->context) { diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c index 1afc6b1e2d..6ba5954409 100644 --- a/libavcodec/jpeg2000dec.c +++ b/libavcodec/jpeg2000dec.c @@ -2495,7 +2495,7 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, AVFrame *picture, } /* get picture buffer */ - if ((ret = ff_thread_get_buffer(avctx, picture, 0)) < 0) + if ((ret = ff_get_buffer(avctx, picture, 0)) < 0) goto end; picture->pict_type = AV_PICTURE_TYPE_I; picture->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 75b557e518..7831106ef3 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -31,11 +31,11 @@ #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "mathops.h" #include "lagarithrac.h" #include "lossless_videodsp.h" -#include "thread.h" #define VLC_BITS 7 @@ -590,7 +590,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, planes = 4; } - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (frametype == FRAME_SOLID_RGBA) { @@ -614,7 +614,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, avctx->pix_fmt = AV_PIX_FMT_GBRAP; } - if ((ret = ff_thread_get_buffer(avctx, p,0)) < 0) + if ((ret = ff_get_buffer(avctx, p,0)) < 0) return ret; for (i = 0; i < avctx->height; i++) { @@ -635,7 +635,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = AV_PIX_FMT_GBRP; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; offs[0] = offset_bv; @@ -671,7 +671,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, case FRAME_ARITH_YUY2: avctx->pix_fmt = AV_PIX_FMT_YUV422P; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (offset_ry >= buf_size || @@ -699,7 +699,7 @@ static int lag_decode_frame(AVCodecContext *avctx, AVFrame *p, case FRAME_ARITH_YV12: avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (offset_ry >= buf_size || diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index b4304618e4..1a52f46fc4 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -47,8 +47,8 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "lcl.h" -#include "thread.h" #if CONFIG_ZLIB_DECODER #include "zlib_wrapper.h" @@ -180,7 +180,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, unsigned int len = buf_size; int linesize, offset; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; outptr = frame->data[0]; // Output image pointer diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c index 3f6348b531..06fdf9e39f 100644 --- a/libavcodec/magicyuv.c +++ b/libavcodec/magicyuv.c @@ -654,7 +654,7 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p, p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; s->buf = avpkt->data; diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index c4904216b8..2855ae7514 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -33,10 +33,10 @@ #include "blockdsp.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "idctdsp.h" #include "mpeg12data.h" #include "mpeg12dec.h" -#include "thread.h" typedef struct MDECContext { AVCodecContext *avctx; @@ -174,7 +174,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int buf_size = avpkt->size; int ret; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; frame->pict_type = AV_PICTURE_TYPE_I; frame->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/notchlc.c b/libavcodec/notchlc.c index 0feb0918f0..ab540362af 100644 --- a/libavcodec/notchlc.c +++ b/libavcodec/notchlc.c @@ -221,7 +221,7 @@ static int decode_blocks(AVCodecContext *avctx, AVFrame *p, return AVERROR_INVALIDDATA; s->uv_count_offset = s->y_data_offset - s->a_data_offset; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; rgb = *gb; diff --git a/libavcodec/photocd.c b/libavcodec/photocd.c index 07e8d460bd..f7d3638273 100644 --- a/libavcodec/photocd.c +++ b/libavcodec/photocd.c @@ -328,7 +328,7 @@ static int photocd_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index 6e925308b8..b015352eda 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -670,7 +670,7 @@ static int pixlet_decode_frame(AVCodecContext *avctx, AVFrame *p, p->flags |= AV_FRAME_FLAG_KEY; p->color_range = AVCOL_RANGE_JPEG; - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index de50e6a5b6..ef342327d0 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -876,7 +876,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, ff_thread_release_ext_buffer(&s->picture); if (s->dispose_op == APNG_DISPOSE_OP_PREVIOUS) { /* We only need a buffer for the current picture. */ - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; } else if (s->dispose_op == APNG_DISPOSE_OP_BACKGROUND) { @@ -886,7 +886,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, AV_GET_BUFFER_FLAG_REF); if (ret < 0) return ret; - ret = ff_thread_get_buffer(avctx, p, 0); + ret = ff_get_buffer(avctx, p, 0); if (ret < 0) return ret; } else { diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c index 3a5b753430..2e7ddbfd22 100644 --- a/libavcodec/proresdec2.c +++ b/libavcodec/proresdec2.c @@ -800,7 +800,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, buf += frame_hdr_size; buf_size -= frame_hdr_size; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ff_thread_finish_setup(avctx); diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index fd356bd190..dd25d99fbb 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -939,9 +939,6 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int fla PerThreadContext *p; int err; - if (!(avctx->active_thread_type & FF_THREAD_FRAME)) - return ff_get_buffer(avctx, f, flags); - p = avctx->internal->thread_ctx; if (atomic_load(&p->state) != STATE_SETTING_UP && ffcodec(avctx->codec)->update_thread_context) { @@ -950,7 +947,7 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, AVFrame *f, int fla } pthread_mutex_lock(&p->parent->buffer_mutex); - err = ff_get_buffer(avctx, f, flags); + err = ff_decode_get_buffer(avctx, f, flags); pthread_mutex_unlock(&p->parent->buffer_mutex); @@ -976,7 +973,7 @@ int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) * This currently affects non-MPEG-4 mpegvideo codecs and and VP7. * The following check will always be true for them. */ if (!(avctx->active_thread_type & FF_THREAD_FRAME)) - return ff_get_buffer(avctx, f->f, flags); + return ff_decode_get_buffer(avctx, f->f, flags); if (ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_ALLOCATE_PROGRESS) { f->progress = ff_refstruct_allocz(sizeof(*f->progress)); diff --git a/libavcodec/qoidec.c b/libavcodec/qoidec.c index 37bc2084c0..f591b2f5a4 100644 --- a/libavcodec/qoidec.c +++ b/libavcodec/qoidec.c @@ -63,7 +63,7 @@ static int qoi_decode_frame(AVCodecContext *avctx, AVFrame *p, if (avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; dst = p->data[0]; diff --git a/libavcodec/rtv1.c b/libavcodec/rtv1.c index 06afe9e873..79926eb65f 100644 --- a/libavcodec/rtv1.c +++ b/libavcodec/rtv1.c @@ -120,7 +120,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, avctx->width = width; avctx->height = height; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; dst = p->data[0] + p->linesize[0] * (avctx->coded_height - 1); diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index 660e2661a4..f78d826884 100644 --- a/libavcodec/sheervideo.c +++ b/libavcodec/sheervideo.c @@ -25,8 +25,8 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "sheervideodata.h" typedef struct SheerVideoContext { @@ -1975,7 +1975,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, p->pict_type = AV_PICTURE_TYPE_I; p->flags |= AV_FRAME_FLAG_KEY; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if ((ret = init_get_bits8(&gb, avpkt->data + 20, avpkt->size - 20)) < 0) diff --git a/libavcodec/takdec.c b/libavcodec/takdec.c index 5cbc2de6bd..76c03f5834 100644 --- a/libavcodec/takdec.c +++ b/libavcodec/takdec.c @@ -32,12 +32,13 @@ #define CACHED_BITSTREAM_READER !ARCH_X86_32 #define BITSTREAM_READER_LE #include "audiodsp.h" -#include "thread.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "unary.h" #include "tak.h" #include "takdsp.h" +#include "thread.h" #define MAX_SUBFRAMES 8 ///< max number of subframes per channel #define MAX_PREDICTORS 256 @@ -742,7 +743,7 @@ static int tak_decode_frame(AVCodecContext *avctx, AVFrame *frame, : s->ti.frame_samples; frame->nb_samples = s->nb_samples; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; ff_thread_finish_setup(avctx); diff --git a/libavcodec/thread.h b/libavcodec/thread.h index 4272fd87d4..5a00b32619 100644 --- a/libavcodec/thread.h +++ b/libavcodec/thread.h @@ -43,16 +43,6 @@ int ff_thread_can_start_frame(AVCodecContext *avctx); */ void ff_thread_finish_setup(AVCodecContext *avctx); -/** - * Wrapper around get_buffer() for frame-multithreaded codecs. - * Call this function instead of ff_get_buffer(f). - * Cannot be called after the codec has called ff_thread_finish_setup(). - * - * @param avctx The current context. - * @param f The frame to write into. - */ -int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags); - int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr), int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count); diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index cb4d378753..e52b61bb33 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -1214,7 +1214,7 @@ static int init_image(TiffContext *s, AVFrame *frame) if (s->avctx->skip_frame >= AVDISCARD_ALL) return 0; - if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) return ret; if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) { if (!create_gray_palette) diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 7763ed7ffc..62b746c123 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -39,8 +39,8 @@ #include "ttadsp.h" #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "unary.h" #define FORMAT_SIMPLE 1 @@ -247,7 +247,7 @@ static int tta_decode_frame(AVCodecContext *avctx, AVFrame *frame, /* get output buffer */ frame->nb_samples = framelen; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; // decode directly to output buffer for 24-bit sample format diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e91a5d6d2e..9b230d9989 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -884,11 +884,6 @@ int ff_thread_replace_frame(ThreadFrame *dst, const ThreadFrame *src) #if !HAVE_THREADS -int ff_thread_get_buffer(AVCodecContext *avctx, AVFrame *f, int flags) -{ - return ff_get_buffer(avctx, f, flags); -} - int ff_thread_get_ext_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) { f->owner[0] = f->owner[1] = avctx; diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index ce5d00f7af..5133bcdbb5 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -36,9 +36,9 @@ #include "bswapdsp.h" #include "bytestream.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "lossless_videodsp.h" -#include "thread.h" #include "utvideo.h" #include "utvideodsp.h" @@ -589,7 +589,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int ret; GetByteContext gb; - if ((ret = ff_thread_get_buffer(avctx, frame, 0)) < 0) + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; /* parse plane structure to get frame flags and validate slice offsets */ diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c index d80fb4e7c6..85f5039fa4 100644 --- a/libavcodec/v210dec.c +++ b/libavcodec/v210dec.c @@ -23,13 +23,13 @@ #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "v210dec.h" #include "v210dec_init.h" #include "libavutil/bswap.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h" -#include "thread.h" typedef struct ThreadData { AVFrame *frame; @@ -183,7 +183,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *pic, ff_v210dec_init(s); } - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c index 35e4a8ae03..e4f25fab88 100644 --- a/libavcodec/v410dec.c +++ b/libavcodec/v410dec.c @@ -24,7 +24,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" #include "codec_internal.h" -#include "thread.h" +#include "decode.h" typedef struct ThreadData { AVFrame *frame; @@ -99,7 +99,7 @@ static int v410_decode_frame(AVCodecContext *avctx, AVFrame *pic, return AVERROR(EINVAL); } - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->flags |= AV_FRAME_FLAG_KEY; diff --git a/libavcodec/vaapi_av1.c b/libavcodec/vaapi_av1.c index 1f9a6071ba..3f3b661789 100644 --- a/libavcodec/vaapi_av1.c +++ b/libavcodec/vaapi_av1.c @@ -23,7 +23,7 @@ #include "vaapi_decode.h" #include "internal.h" #include "av1dec.h" -#include "thread.h" +#include "decode.h" typedef struct VAAPIAV1FrameRef { AVFrame *frame; @@ -127,7 +127,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, if (apply_grain) { if (ctx->tmp_frame->buf[0]) av_frame_unref(ctx->tmp_frame); - err = ff_thread_get_buffer(avctx, ctx->tmp_frame, AV_GET_BUFFER_FLAG_REF); + err = ff_get_buffer(avctx, ctx->tmp_frame, AV_GET_BUFFER_FLAG_REF); if (err < 0) goto fail; pic->output_surface = ff_vaapi_get_surface_id(ctx->tmp_frame); diff --git a/libavcodec/vble.c b/libavcodec/vble.c index 7711bf1bb1..4d4f126d36 100644 --- a/libavcodec/vble.c +++ b/libavcodec/vble.c @@ -29,10 +29,10 @@ #define BITSTREAM_READER_LE #include "avcodec.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" #include "lossless_videodsp.h" #include "mathops.h" -#include "thread.h" typedef struct VBLEContext { AVCodecContext *avctx; @@ -131,7 +131,7 @@ static int vble_decode_frame(AVCodecContext *avctx, AVFrame *pic, } /* Allocate buffer */ - if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; /* Set flags */ diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c index d6b6e3557f..4fceb6d5e2 100644 --- a/libavcodec/vmixdec.c +++ b/libavcodec/vmixdec.c @@ -280,7 +280,7 @@ static int decode_frame(AVCodecContext *avctx, offset += slice_size + 4; } - ret = ff_thread_get_buffer(avctx, frame, 0); + ret = ff_get_buffer(avctx, frame, 0); if (ret < 0) return ret; diff --git a/libavcodec/vvc/vvc_refs.c b/libavcodec/vvc/vvc_refs.c index 99f2dcf3ec..de5f582006 100644 --- a/libavcodec/vvc/vvc_refs.c +++ b/libavcodec/vvc/vvc_refs.c @@ -24,7 +24,7 @@ #include "libavutil/thread.h" #include "libavcodec/refstruct.h" -#include "libavcodec/thread.h" +#include "libavcodec/decode.h" #include "vvc_refs.h" @@ -118,7 +118,7 @@ static VVCFrame *alloc_frame(VVCContext *s, VVCFrameContext *fc) if (frame->frame->buf[0]) continue; - ret = ff_thread_get_buffer(s->avctx, frame->frame, AV_GET_BUFFER_FLAG_REF); + ret = ff_get_buffer(s->avctx, frame->frame, AV_GET_BUFFER_FLAG_REF); if (ret < 0) return NULL; diff --git a/libavcodec/wbmpdec.c b/libavcodec/wbmpdec.c index 3b5753abcd..7d3a32bb13 100644 --- a/libavcodec/wbmpdec.c +++ b/libavcodec/wbmpdec.c @@ -66,7 +66,7 @@ static int wbmp_decode_frame(AVCodecContext *avctx, AVFrame *p, return ret; avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; if (p->linesize[0] == (width + 7) / 8) diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 9308ea2b69..45e7344965 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -570,7 +570,7 @@ static int decode_entropy_coded_image(WebPContext *s, enum ImageRole role, img->frame->height = h; if (role == IMAGE_ROLE_ARGB && !img->is_alpha_primary) { - ret = ff_thread_get_buffer(s->avctx, img->frame, 0); + ret = ff_get_buffer(s->avctx, img->frame, 0); } else ret = av_frame_get_buffer(img->frame, 1); if (ret < 0) diff --git a/libavcodec/ylc.c b/libavcodec/ylc.c index b03df31556..8c2503fb01 100644 --- a/libavcodec/ylc.c +++ b/libavcodec/ylc.c @@ -28,8 +28,8 @@ #include "avcodec.h" #include "bswapdsp.h" #include "codec_internal.h" +#include "decode.h" #include "get_bits.h" -#include "thread.h" #include "unary.h" typedef struct YLCContext { @@ -300,7 +300,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p, if (toffset >= boffset || boffset >= avpkt->size) return AVERROR_INVALIDDATA; - if ((ret = ff_thread_get_buffer(avctx, p, 0)) < 0) + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; av_fast_malloc(&s->buffer, &s->buffer_size,