From patchwork Mon Jul 27 16:32:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 21298 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 DFE6644B627 for ; Mon, 27 Jul 2020 19:33:01 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CD03268B920; Mon, 27 Jul 2020 19:33:01 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4602568B8C8 for ; Mon, 27 Jul 2020 19:32:54 +0300 (EEST) Received: by mail-wr1-f45.google.com with SMTP id b6so15531360wrs.11 for ; Mon, 27 Jul 2020 09:32:54 -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=4NxB4LUg8yXIFgK731yG9WpPfpsSOcpBwnzJbUVGo2k=; b=AsuQTUyB0E21lvNmNFwXAhB/vUQu8FowTN9JfKhcHH+fAwSQhfTQejzYB8Qwdt8eAk XRVh58hUUwkpLAI5IYMG667WTXJXe+nfjsKsCU5fIU5YxAKX1WqFJBpgtBZGyzqrK6Ry 1JcPA/Q9/N1UluszPUc9xF7t2xzzyeEP1+vPg6ZjxgRReGM8rETFl6xLOErhN6OpjVZP KnzGACgy19UA9mpTBQs4MUSNhsWEMQP8js3kEm4At18khBXjAWAXUlFCvUQ0n/5hXhK/ Hy1xK1WCoGUhY58y5LMTijjeq0P5+MwG4CMsL935oF4rEDLXb+Ra+wFVTxpkIqWrWFLO snPw== 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=4NxB4LUg8yXIFgK731yG9WpPfpsSOcpBwnzJbUVGo2k=; b=bXzU+gYxGQswQZHXEOsf9u+IArrEeF7wiro+fcOG6K+xWBFym/pnUC87Ug9ibxb05L KE/6VGLVCskWncvRPXovHpVTxMTLyYB+YKjIKTnkK41czMB6U6uvX4tFEMFKVAdiBzsw hWtD5+C3exWVH0ifkb/xEC9CmJATKlY4VXFlPHgLkwSEk0auqOH9eT2J2e9GPTYoGo8S WZ9YUCHJrZ7OVShW08qsQFD6aXUhRpZCu1UwREEEREMSBRCkLe2zTXXtnoGoxnxRPWj5 P1XF5bZUSqZqkcjPHZphweLhC4mBmR3MPVh37quEqKz4HiPm/EVdmWYxGL3/AHPin/rH Jb8g== X-Gm-Message-State: AOAM530EHF+Q+rIv+0ux0oaTXZJ55dgXgFk+H3MFiS5kxKIFzvLg/xBN fr3CufT/tMSkQc9IE6q35xpJWkwibQw= X-Google-Smtp-Source: ABdhPJz3WV2Wkuils/W15kozQbYNUlaBOxriidRUdxgRzCxaMX2Bt3eNFZlZ/SHGjguxR+tay+Y8pw== X-Received: by 2002:adf:f44b:: with SMTP id f11mr3459168wrp.114.1595867573446; Mon, 27 Jul 2020 09:32:53 -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 w16sm14706791wrg.95.2020.07.27.09.32.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 09:32:52 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jul 2020 17:32:25 +0100 Message-Id: <20200727163237.23371-11-sw@jkqxz.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727163237.23371-1-sw@jkqxz.net> References: <20200727163237.23371-1-sw@jkqxz.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 10/22] 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 6e0a7dcbea..6a480b4ce3 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -479,13 +479,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) { @@ -497,8 +490,7 @@ static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content(unit, sizeof(*frame), - &cbs_vp9_free_frame); + err = ff_cbs_alloc_unit_content2(ctx, unit); if (err < 0) return err; frame = unit->content; @@ -642,11 +634,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,