From patchwork Mon May 20 23:02:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 13204 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 CD2D344627B for ; Tue, 21 May 2019 02:02:44 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B5C6368A843; Tue, 21 May 2019 02:02:44 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 964E768A775 for ; Tue, 21 May 2019 02:02:38 +0300 (EEST) Received: by mail-wr1-f44.google.com with SMTP id l2so16352006wrb.9 for ; Mon, 20 May 2019 16:02:38 -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=reqhatI/eDZdNT106lUprlHURzWildQRCSiKF7FVhpM=; b=OWO4mi2c/7M4U+NmuO0hr1xdMPcRdsH/3wpKRsL7qG7EXIA744G1Sft7ZQL3dHwP0A 31BN9/txuhkOYIiJLiYhbiHXuoWs72JFsXUpz9glycwRae16bLpkAA2q9bA7PI0H9a/C IS+oa+0sUtjmoHqT88Ytuvs21gjaDIvf+hzaegYOlB2iXlotPqLfKuR1rRJeaSEqlBp2 2D7UGZyXtO5yu8hnsqEDYi+meJETc17ti7lNywswWshBdfA6/AG+WSytRbC8VbgPzaIa CX72Jgd6178WVCwjI51euVohy+ns2iHhItsBqlypAQaU7dfaQq/7eOaFuJ5uJmbsmP81 7jqA== 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=reqhatI/eDZdNT106lUprlHURzWildQRCSiKF7FVhpM=; b=cuUxpF2LVqEreDO/N+e0jf51lRRqxTEYeV7sC+dMceAEBSC5Mej4v2LW21K5bDUIyz ev/n3MNMok2EuPG0ot3gseV8/309XZNu9ZdChFwtZiPCJEBBBCGK/TfJP7MNWkjvtfl9 KsJrH/8SI7pNcWvV6/kkv5Febw9t3pgl7CuC/q6QlUQkCLpeMGWW2SI48i3/w1nH2OEb e4omn72+E41engHcu+GHSX1Fh94a6tijZmkVQjkRK3hvrcabopOrmGRhkdujK+st2oCs 1As6SEDD2l85gngadv6il0JD8HUdxaTpMQ7NJKy0S3E/+KmhYXBpRZX3JR/FhMnDkw31 uRVw== X-Gm-Message-State: APjAAAUvk7hBjQovV0rmuf39ADgNuBS9Cnd+GqUNV86sNilXdLZmcMDl ZdFhGXpRIGCRcGs/5iIK2cmtyY9n4eM= X-Google-Smtp-Source: APXvYqxO9f5JWjmcQsB63JSeKBd8oIJnaIvwB/vXQTl2svzbWK7hqa6xS9A1l9Mof3Q8qbW8h8kouQ== X-Received: by 2002:a5d:4cc4:: with SMTP id c4mr35543797wrt.164.1558393357967; Mon, 20 May 2019 16:02:37 -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 z14sm13858538wrq.22.2019.05.20.16.02.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 16:02:37 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Tue, 21 May 2019 00:02:23 +0100 Message-Id: <20190520230224.19221-10-sw@jkqxz.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520230224.19221-1-sw@jkqxz.net> References: <20190520230224.19221-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 10/11] 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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index 0b5f137ed8..71c1b38032 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 *unit, 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,19 @@ static void cbs_vp9_close(CodedBitstreamContext *ctx) av_freep(&priv->write_buffer); } +static const CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[] = { + CBS_UNIT_TYPE_INTERNAL_REFS(0, VP9RawFrame, 1, + { offsetof(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,