From patchwork Fri Oct 2 18:03:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 22714 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:c650:0:0:0:0:0 with SMTP id k77csp1481954ybf; Fri, 2 Oct 2020 11:05:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXgfVDK2phEPuqySPrRBdeJC5cPMa67AwcOi4Urt34QlwYDRJ7ReuPyZH8bY3OwiALSiAQ X-Received: by 2002:a1c:e045:: with SMTP id x66mr3334128wmg.104.1601661901137; Fri, 02 Oct 2020 11:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601661901; cv=none; d=google.com; s=arc-20160816; b=RfsfoRjr/Y9lh9vcPParsCgz0hSPfTLP2AEiYUFKh2TlQ7H53/mkRAtLRlH1YRDUCs cw6er5SZOOkWXXs+qUbSqy/CilzG8CzMg2L20fLoBgf/JnZJdhvhw+lSRB5qCCSuKJB+ taJmOF1rPVxCkhpR1wneJ0HwNze93AB2gk8FsU3d8xuTThbnCwJWwvLLbUkjewrHT84t 5yo4kBjlWJKOCpmEqtmC+Obbni++t4YEFYPZ91du79fEknCQuzh84/nVHUz2acxOxvef L5XvbIpb09mCNhR9gaEb72rB/Q6o5x6JVRGsY20pbkW9k44f8lpslLTDRsLnT3kHmVR7 OPMA== 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:delivered-to; bh=AXwvjus/OXR61Kl1BulmgtPLcUVfmIATSdnRUkvpxc4=; b=h95a5uVTR3G2feeUIPw2NLcJh3SS2hHd8hE3mlZMvkaGhuP0EoHozHAzQVwafxtNuD 6kuxq4LwlsElPMEcxuH53aiXp3y+06GbLOMVTkBCypODFk7rWe0U4Ma1+s5l03i983/E mEQvo6J8wMfY+vws0aWcPAtjTZy2sqzUq2ES+ZqA9r7tNf3Y4HGkTpKeXMXXCTSY65OD OHXVFg/UpS3zICNkdbmLN3rOEMU7pVsPYPOB8R7yqbVMS633ZoubS8tatHOftt0y9/R7 YP0vMgujATFYVL5fiQfmAhA2C/nohQ1VtghdTwc2CLbBpfm1ZxF9OJyBXwazhfgiyG5m yWpg== ARC-Authentication-Results: i=1; mx.google.com; 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 o5si2553825wme.89.2020.10.02.11.05.00; Fri, 02 Oct 2020 11:05:01 -0700 (PDT) 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; 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 4C0EC68A9E1; Fri, 2 Oct 2020 21:04:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E2D8968A562 for ; Fri, 2 Oct 2020 21:03:54 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 9DF392960FB for ; Fri, 2 Oct 2020 20:03:51 +0200 (CEST) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id UJL3Ud0StSdQ for ; Fri, 2 Oct 2020 20:03:50 +0200 (CEST) Received: from libav.daenerys.khirnov.net (libav.daenerys.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.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id BC4D8296117 for ; Fri, 2 Oct 2020 20:03:47 +0200 (CEST) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 194CF20E0231; Fri, 2 Oct 2020 20:03:46 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 2 Oct 2020 20:03:31 +0200 Message-Id: <20201002180331.20416-7-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201002180331.20416-1-anton@khirnov.net> References: <20201002180331.20416-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/7] lavfi/vf_codecview: convert to the video_enc_params API 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" X-TUID: 6mT7kOuwL7GV Content-Length: 3599 --- libavfilter/Makefile | 2 +- libavfilter/vf_codecview.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libavfilter/Makefile b/libavfilter/Makefile index be2c3e3156..119a9c513b 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -185,7 +185,7 @@ OBJS-$(CONFIG_CHROMAKEY_FILTER) += vf_chromakey.o OBJS-$(CONFIG_CHROMANR_FILTER) += vf_chromanr.o OBJS-$(CONFIG_CHROMASHIFT_FILTER) += vf_chromashift.o OBJS-$(CONFIG_CIESCOPE_FILTER) += vf_ciescope.o -OBJS-$(CONFIG_CODECVIEW_FILTER) += vf_codecview.o +OBJS-$(CONFIG_CODECVIEW_FILTER) += vf_codecview.o qp_table.o OBJS-$(CONFIG_COLORBALANCE_FILTER) += vf_colorbalance.o OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER) += vf_colorchannelmixer.o OBJS-$(CONFIG_COLORKEY_FILTER) += vf_colorkey.o diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index 331bfba777..bdcbe42162 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -33,6 +33,7 @@ #include "libavutil/motion_vector.h" #include "libavutil/opt.h" #include "avfilter.h" +#include "qp_table.h" #include "internal.h" #define MV_P_FOR (1<<0) @@ -219,8 +220,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFilterLink *outlink = ctx->outputs[0]; if (s->qp) { - int qstride, qp_type; - int8_t *qp_table = av_frame_get_qp_table(frame, &qstride, &qp_type); + int qstride, ret; + int8_t *qp_table; + + ret = ff_qp_table_extract(frame, &qp_table, &qstride, NULL); + if (ret < 0) { + av_frame_free(&frame); + return ret; + } if (qp_table) { int x, y; @@ -233,13 +240,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - const int qp = ff_norm_qscale(qp_table[(y >> 3) * qstride + (x >> 3)], qp_type) * 128/31; + const int qp = ff_norm_qscale(qp_table[(y >> 3) * qstride + (x >> 3)], FF_QSCALE_TYPE_MPEG2) * 128/31; pu[x] = pv[x] = qp; } pu += lzu; pv += lzv; } } + av_freep(&qp_table); } if (s->mv || s->mv_type) {