From patchwork Wed Oct 2 23:04:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 15475 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 B580A44A176 for ; Thu, 3 Oct 2019 02:10:30 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A63F068814D; Thu, 3 Oct 2019 02:10:30 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5FF1687F69 for ; Thu, 3 Oct 2019 02:10:23 +0300 (EEST) Received: by mail-wr1-f49.google.com with SMTP id v8so819461wrt.2 for ; Wed, 02 Oct 2019 16:10:23 -0700 (PDT) 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=aeHznTEr9JXTb8DtCKJM0HEm60aPH1VJhGYE/7jLP8A=; b=oXePbcmTeP9ChTNkqiSNwbQK2e/aobPOdCI+VOTY56FV8HP0JOJ66PWLQi5Xsv4vlO D5GEL0Xgxt8yVD4CgOJwdPtw8iG+THxsrV+Bn9otqyPQAH7M7ORNDzvTdetpK7qcbU6q H4683kwqJl3MyYisupoiMtBK1v+MwB3R3/IBRj3LDOacxeJ1aDSf45W1+MMwDHBLA2Lz d5n0KYzOmfJMXF6AFSpAid8M3N4HIlIU4dFp4rrIVlOHZ42D8iTnWW+7X6ze0/4O0IYT BV4OQV/S3rUhLsMfZRYveGNvlE1pIinD93b8dMHy6f0BOf46srS2lw9RfRE+8ESllNqI NwpQ== 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=aeHznTEr9JXTb8DtCKJM0HEm60aPH1VJhGYE/7jLP8A=; b=jtnfMGGDF1X1yJwhk8PMxRv0S5dxhjTOefJ98Dss7TjOWNbTntFK2pyFojDoAGvt3O mkQeBO1I+G53T7aK8n7eAJ8kUe/5IL+iRXRzX9tcj3xeOIEhUT+oM2bCIQZmHtG1lXYM 33qQkKI/uiwxzPMh+AAInNidkKZVa1xvvn8THbUPekWoM8kcjghlf0Eeyh7Xl3u3qlo4 oWZyuRE1AFJhmMw+cVWNF0a41ju3Yu3Q4PWjia39G85WOhtqm7F3lCUoF5PikiQbyTZm gIMrsLk4EuuC1EBQOx3Kl6kJqtrW1+a79uKdVSPh25qop/0dqoQE0YfVJbJ4rXMLf2Rp ChAw== X-Gm-Message-State: APjAAAVD+IC4m8UOnJV+tQPV0OCMIZMcvDYp/H3c+pPCtgdZCPWMyXrG RV8bvukjvuhQua17P+StH0Q3JndrXzY= X-Google-Smtp-Source: APXvYqz0PTBV2hqnt2Sh9VxtmImaly4oS1CW2yg6hmXJ9/U9wzDMq2U3h6vHvBRwYgjRZl/+MyP+wA== X-Received: by 2002:a05:6000:108c:: with SMTP id y12mr4342720wrw.238.1570057506132; Wed, 02 Oct 2019 16:05:06 -0700 (PDT) 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 o9sm1489808wrh.46.2019.10.02.16.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2019 16:05:05 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Oct 2019 00:04:45 +0100 Message-Id: <20191002230453.6462-10-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191002230453.6462-1-sw@jkqxz.net> References: <20191002230453.6462-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 10/18] 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 bd172100fc..df480f42e5 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -474,13 +474,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) { @@ -492,8 +485,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; @@ -678,11 +670,18 @@ static void cbs_vp9_close(CodedBitstreamContext *ctx) av_freep(&priv->write_buffer); } +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,