From patchwork Sun Feb 23 23:41:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 17889 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 80A7644A08D for ; Mon, 24 Feb 2020 01:49:28 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6F0C668B4CF; Mon, 24 Feb 2020 01:49:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 54ADA68B490 for ; Mon, 24 Feb 2020 01:49:22 +0200 (EET) Received: by mail-wm1-f67.google.com with SMTP id a5so7218217wmb.0 for ; Sun, 23 Feb 2020 15:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jkqxz-net.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=8OHbcLoG7hKdisBCfFz6HODqXCg7EZyQpQZB4zabBxs=; b=WsdNj54GeqyE3HkGgCcqkuPjaRRqS789cevZEPxifWVNs4QOrCsr/qHbQ9iKz4j5WQ 4Ong15BeK97XfjdFDzPhl2ee7wId7m6QSz3kgPhvtFXWww/KIs8SxAT6FE62YCUFWWoK 4Mjw6VZ2q6mtu7kn6R5xgXtaoPyXDoQXew3ogkMG42URB5jOrjCmrlSnmlCwXVaTxUzO P5K+IHoXNHWv9gi0KdCH0H0SUx9ZolVmZEHx/Th/0Dio6Z4/aaVBYe3JA8koX4KE3Ccf ASJp2GqouIGEL2hjELdd8JVt5do9CWDmow7eJgZgLn1Z2s3PzGRkyGGWzqhNWhFKDJwh Qhqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8OHbcLoG7hKdisBCfFz6HODqXCg7EZyQpQZB4zabBxs=; b=eA/WAQ/d1gXjuVVobxW9T1cfLJk7iAhYvFQjWRzSC4ho/Nm9DkIw4tHNXdYT+z3TvB 9goLxTOGBt21J6hvMGpBUQCZyFjy3SqwZSOQZ4t42l+rbdguykP501lhqFEsUcwdLoEg 4YposlSoeWjALAsM7Ksiuo4aKbPZmnvXHUCeLpi7OoiMab34DiAqq6nWrPvLz9fLAkGV /wiy2t2FQTT4rozSiRfb2xaG3hFJyS/lJZQtJejy7eR+Rm6/g8d+UN+Kq+Cyo2q+HdwT xW/whTcRTmQyyp1VL0mV2Ow2i3gg9vY9vV5ExkOJ5SetV7mILGwDu50WxQxSORdqis3B 7X8A== X-Gm-Message-State: APjAAAU6HqSP9sU7ygvy1aiLXkd6WP7rS6jYn3d0E4Ioqs/bllxGk1jr r9ePbYdh38l+sWG4NvgWm2uRT10gjJ8= X-Google-Smtp-Source: APXvYqxyL1dX31C91H54Qk7EW0wPmhPB+dMPvHWtsiQnC9fWa4oKkjORNSLGFPyW2CSHsOMgI5NTJQ== X-Received: by 2002:a05:600c:20e:: with SMTP id 14mr18191359wmi.104.1582501302577; Sun, 23 Feb 2020 15:41:42 -0800 (PST) Received: from rywe.jkqxz.net (cpc91242-cmbg18-2-0-cust650.5-4.cable.virginm.net. [82.8.130.139]) by smtp.gmail.com with ESMTPSA id y131sm16358070wmc.13.2020.02.23.15.41.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Feb 2020 15:41:41 -0800 (PST) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Feb 2020 23:41:13 +0000 Message-Id: <20200223234124.17689-10-sw@jkqxz.net> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200223234124.17689-1-sw@jkqxz.net> References: <20200223234124.17689-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 10/21] cbs_vp9: Use table-based alloc/free X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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" --- libavcodec/cbs_vp9.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index ec82f11c76..343bf51275 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -480,13 +480,6 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, return 0; } -static void cbs_vp9_free_frame(void *opaque, uint8_t *content) -{ - VP9RawFrame *frame = (VP9RawFrame*)content; - av_buffer_unref(&frame->data_ref); - av_freep(&frame); -} - static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { @@ -498,8 +491,7 @@ static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content(ctx, unit, sizeof(*frame), - &cbs_vp9_free_frame); + err = ff_cbs_alloc_unit_content2(ctx, unit); if (err < 0) return err; frame = unit->content; @@ -643,11 +635,18 @@ static int cbs_vp9_assemble_fragment(CodedBitstreamContext *ctx, return 0; } +static const CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[] = { + CBS_UNIT_TYPE_INTERNAL_REF(0, VP9RawFrame, data), + CBS_UNIT_TYPE_END_OF_LIST +}; + const CodedBitstreamType ff_cbs_type_vp9 = { .codec_id = AV_CODEC_ID_VP9, .priv_data_size = sizeof(CodedBitstreamVP9Context), + .unit_types = cbs_vp9_unit_types, + .split_fragment = &cbs_vp9_split_fragment, .read_unit = &cbs_vp9_read_unit, .write_unit = &cbs_vp9_write_unit,