From patchwork Mon Feb 24 12:37:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17914 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 1689F44A135 for ; Mon, 24 Feb 2020 14:39:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04BA568B597; Mon, 24 Feb 2020 14:39:43 +0200 (EET) 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 ESMTP id D948868B59A for ; Mon, 24 Feb 2020 14:39:40 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 92A5A2951A7 for ; Mon, 24 Feb 2020 13:39:40 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id z46WjyV-vQ3z for ; Mon, 24 Feb 2020 13:39:40 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 2A5D0295126 for ; Mon, 24 Feb 2020 13:39:40 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id CC45B2522B for ; Mon, 24 Feb 2020 13:39:39 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id TZcBAND9mzzi for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 6939325225 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id D3AC220E0017; Mon, 24 Feb 2020 13:39:10 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:28 +0100 Message-Id: <20200224123739.31154-2-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 01/12] fifo: uninline av_fifo_peek2() on the next major bump 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" Inline public functions should be avoided unless absolutely necessary, and no such necessity exists in this code. --- libavutil/fifo.c | 13 +++++++++++++ libavutil/fifo.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/libavutil/fifo.c b/libavutil/fifo.c index 1060aedf13..0baaadc521 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -23,6 +23,7 @@ #include "avassert.h" #include "common.h" #include "fifo.h" +#include "version.h" static AVFifoBuffer *fifo_alloc_common(void *buffer, size_t size) { @@ -238,3 +239,15 @@ void av_fifo_drain(AVFifoBuffer *f, int size) f->rptr -= f->end - f->buffer; f->rndx += size; } + +#if LIBAVUTIL_VERSION_MAJOR >= 57 +uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs); +{ + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} +#endif diff --git a/libavutil/fifo.h b/libavutil/fifo.h index dc7bc6f0dd..8cd964ef45 100644 --- a/libavutil/fifo.h +++ b/libavutil/fifo.h @@ -27,6 +27,7 @@ #include #include "avutil.h" #include "attributes.h" +#include "version.h" typedef struct AVFifoBuffer { uint8_t *buffer; @@ -166,6 +167,7 @@ void av_fifo_drain(AVFifoBuffer *f, int size); * point outside to the buffer data. * The used buffer size can be checked with av_fifo_size(). */ +#if LIBAVUTIL_VERSION_MAJOR < 57 static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) { uint8_t *ptr = f->rptr + offs; @@ -175,5 +177,8 @@ static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) ptr = f->end - (f->buffer - ptr); return ptr; } +#else +uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs); +#endif #endif /* AVUTIL_FIFO_H */ From patchwork Mon Feb 24 12:37:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17904 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 C13B144A135 for ; Mon, 24 Feb 2020 14:39:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AB79468B4D7; Mon, 24 Feb 2020 14:39:27 +0200 (EET) 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 ESMTP id B953F68B3E7 for ; Mon, 24 Feb 2020 14:39:19 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 785F0295126 for ; Mon, 24 Feb 2020 13:39:19 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id jrVV5Oe7Nk_A for ; Mon, 24 Feb 2020 13:39:19 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 7CE842951AA for ; Mon, 24 Feb 2020 13:39:18 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 342CD2522B for ; Mon, 24 Feb 2020 13:39:18 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id MgwUcB9OAtMe for ; Mon, 24 Feb 2020 13:39:17 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 6F7882522D for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id DF42820E0353; Mon, 24 Feb 2020 13:39:10 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:29 +0100 Message-Id: <20200224123739.31154-3-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 02/12] fifo: hide the definition of AVFifoBuffer in next+1 major bump 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" There is no reason whatsoever for it to be public. --- libavutil/fifo.c | 9 +++++++++ libavutil/fifo.h | 8 ++++++-- libavutil/tests/fifo.c | 2 +- libavutil/version.h | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/libavutil/fifo.c b/libavutil/fifo.c index 0baaadc521..f58530a26e 100644 --- a/libavutil/fifo.c +++ b/libavutil/fifo.c @@ -25,6 +25,15 @@ #include "fifo.h" #include "version.h" +#if !FF_API_FIFO +struct AVFifoBuffer +{ + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +}; +#endif + static AVFifoBuffer *fifo_alloc_common(void *buffer, size_t size) { AVFifoBuffer *f; diff --git a/libavutil/fifo.h b/libavutil/fifo.h index 8cd964ef45..6c0e806c80 100644 --- a/libavutil/fifo.h +++ b/libavutil/fifo.h @@ -29,11 +29,15 @@ #include "attributes.h" #include "version.h" -typedef struct AVFifoBuffer { +typedef struct AVFifoBuffer +#if FF_API_FIFO +{ uint8_t *buffer; uint8_t *rptr, *wptr, *end; uint32_t rndx, wndx; -} AVFifoBuffer; +} AVFifoBuffer +#endif +; /** * Initialize an AVFifoBuffer. diff --git a/libavutil/tests/fifo.c b/libavutil/tests/fifo.c index 8a550e088b..5982d63bba 100644 --- a/libavutil/tests/fifo.c +++ b/libavutil/tests/fifo.c @@ -18,7 +18,7 @@ #include #include -#include "libavutil/fifo.h" +#include "libavutil/fifo.c" int main(void) { diff --git a/libavutil/version.h b/libavutil/version.h index 90cc55b9ac..c271e85d29 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -129,6 +129,9 @@ #ifndef FF_API_PSEUDOPAL #define FF_API_PSEUDOPAL (LIBAVUTIL_VERSION_MAJOR < 57) #endif +#ifndef FF_API_FIFO +#define FF_API_FIFO (LIBAVUTIL_VERSION_MAJOR < 58) +#endif /** From patchwork Mon Feb 24 12:37:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17908 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 6A8F044A135 for ; Mon, 24 Feb 2020 14:39:32 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 45C6068B0E0; Mon, 24 Feb 2020 14:39:32 +0200 (EET) 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 ESMTP id A02A368B488 for ; Mon, 24 Feb 2020 14:39:22 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 50CDB2951AA for ; Mon, 24 Feb 2020 13:39:22 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 0Rj59mwBtrcI for ; Mon, 24 Feb 2020 13:39:21 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (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 "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id D33232951A8 for ; Mon, 24 Feb 2020 13:39:21 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 7A5D22522B for ; Mon, 24 Feb 2020 13:39:20 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Gxh2XiPx0Z2n for ; Mon, 24 Feb 2020 13:39:18 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 7153D2522E for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 08B8B20E0355; Mon, 24 Feb 2020 13:39:10 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:30 +0100 Message-Id: <20200224123739.31154-4-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 03/12] lavfi: drop vf_qp 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" It fundamentally depends on an API that has been deprecated for five years, has seen no commits since that time and is of highly dubious usefulness. --- doc/filters.texi | 32 ------- libavfilter/Makefile | 1 - libavfilter/allfilters.c | 1 - libavfilter/vf_qp.c | 183 ------------------------------------ tests/fate/filter-video.mak | 7 +- tests/ref/fate/filter-pp2 | 1 - tests/ref/fate/filter-pp3 | 1 - 7 files changed, 1 insertion(+), 225 deletions(-) delete mode 100644 libavfilter/vf_qp.c delete mode 100644 tests/ref/fate/filter-pp2 delete mode 100644 tests/ref/fate/filter-pp3 diff --git a/doc/filters.texi b/doc/filters.texi index 70fd7a4cc7..2a1235183f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -15335,38 +15335,6 @@ telecine NTSC input: ffmpeg -i input -vf pullup -r 24000/1001 ... @end example -@section qp - -Change video quantization parameters (QP). - -The filter accepts the following option: - -@table @option -@item qp -Set expression for quantization parameter. -@end table - -The expression is evaluated through the eval API and can contain, among others, -the following constants: - -@table @var -@item known -1 if index is not 129, 0 otherwise. - -@item qp -Sequential index starting from -129 to 128. -@end table - -@subsection Examples - -@itemize -@item -Some equation like: -@example -qp=2+2*sin(PI*qp) -@end example -@end itemize - @section random Flush video frames from internal cache of frames into a random order. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 089880a39d..74968b32e1 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -349,7 +349,6 @@ OBJS-$(CONFIG_PROGRAM_OPENCL_FILTER) += vf_program_opencl.o opencl.o fra OBJS-$(CONFIG_PSEUDOCOLOR_FILTER) += vf_pseudocolor.o OBJS-$(CONFIG_PSNR_FILTER) += vf_psnr.o framesync.o OBJS-$(CONFIG_PULLUP_FILTER) += vf_pullup.o -OBJS-$(CONFIG_QP_FILTER) += vf_qp.o OBJS-$(CONFIG_RANDOM_FILTER) += vf_random.o OBJS-$(CONFIG_READEIA608_FILTER) += vf_readeia608.o OBJS-$(CONFIG_READVITC_FILTER) += vf_readvitc.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 88ebd121ad..aa6f006ddb 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -332,7 +332,6 @@ extern AVFilter ff_vf_program_opencl; extern AVFilter ff_vf_pseudocolor; extern AVFilter ff_vf_psnr; extern AVFilter ff_vf_pullup; -extern AVFilter ff_vf_qp; extern AVFilter ff_vf_random; extern AVFilter ff_vf_readeia608; extern AVFilter ff_vf_readvitc; diff --git a/libavfilter/vf_qp.c b/libavfilter/vf_qp.c deleted file mode 100644 index 33d39493bc..0000000000 --- a/libavfilter/vf_qp.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "libavutil/eval.h" -#include "libavutil/imgutils.h" -#include "libavutil/pixdesc.h" -#include "libavutil/opt.h" -#include "avfilter.h" -#include "formats.h" -#include "internal.h" -#include "video.h" - -typedef struct QPContext { - const AVClass *class; - char *qp_expr_str; - int8_t lut[257]; - int h, qstride; - int evaluate_per_mb; -} QPContext; - -#define OFFSET(x) offsetof(QPContext, x) -#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM - -static const AVOption qp_options[] = { - { "qp", "set qp expression", OFFSET(qp_expr_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, - { NULL } -}; - -AVFILTER_DEFINE_CLASS(qp); - -static int config_input(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->dst; - QPContext *s = ctx->priv; - int i; - int ret; - AVExpr *e = NULL; - static const char *var_names[] = { "known", "qp", "x", "y", "w", "h", NULL }; - - if (!s->qp_expr_str) - return 0; - - ret = av_expr_parse(&e, s->qp_expr_str, var_names, NULL, NULL, NULL, NULL, 0, ctx); - if (ret < 0) - return ret; - - s->h = (inlink->h + 15) >> 4; - s->qstride = (inlink->w + 15) >> 4; - for (i = -129; i < 128; i++) { - double var_values[] = { i != -129, i, NAN, NAN, s->qstride, s->h, 0}; - double temp_val = av_expr_eval(e, var_values, NULL); - - if (isnan(temp_val)) { - if(strchr(s->qp_expr_str, 'x') || strchr(s->qp_expr_str, 'y')) - s->evaluate_per_mb = 1; - else { - av_expr_free(e); - return AVERROR(EINVAL); - } - } - - s->lut[i + 129] = lrintf(temp_val); - } - av_expr_free(e); - - return 0; -} - -static int filter_frame(AVFilterLink *inlink, AVFrame *in) -{ - AVFilterContext *ctx = inlink->dst; - AVFilterLink *outlink = ctx->outputs[0]; - QPContext *s = ctx->priv; - AVBufferRef *out_qp_table_buf; - AVFrame *out = NULL; - const int8_t *in_qp_table; - int type, stride, ret; - - if (!s->qp_expr_str || ctx->is_disabled) - return ff_filter_frame(outlink, in); - - out_qp_table_buf = av_buffer_alloc(s->h * s->qstride); - if (!out_qp_table_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - - out = av_frame_clone(in); - if (!out) { - av_buffer_unref(&out_qp_table_buf); - ret = AVERROR(ENOMEM); - goto fail; - } - - in_qp_table = av_frame_get_qp_table(in, &stride, &type); - av_frame_set_qp_table(out, out_qp_table_buf, s->qstride, type); - - - if (s->evaluate_per_mb) { - int y, x; - - for (y = 0; y < s->h; y++) - for (x = 0; x < s->qstride; x++) { - int qp = in_qp_table ? in_qp_table[x + stride * y] : NAN; - double var_values[] = { !!in_qp_table, qp, x, y, s->qstride, s->h, 0}; - static const char *var_names[] = { "known", "qp", "x", "y", "w", "h", NULL }; - double temp_val; - - ret = av_expr_parse_and_eval(&temp_val, s->qp_expr_str, - var_names, var_values, - NULL, NULL, NULL, NULL, 0, 0, ctx); - if (ret < 0) - goto fail; - out_qp_table_buf->data[x + s->qstride * y] = lrintf(temp_val); - } - } else if (in_qp_table) { - int y, x; - - for (y = 0; y < s->h; y++) - for (x = 0; x < s->qstride; x++) - out_qp_table_buf->data[x + s->qstride * y] = s->lut[129 + - ((int8_t)in_qp_table[x + stride * y])]; - } else { - int y, x, qp = s->lut[0]; - - for (y = 0; y < s->h; y++) - for (x = 0; x < s->qstride; x++) - out_qp_table_buf->data[x + s->qstride * y] = qp; - } - - ret = ff_filter_frame(outlink, out); - out = NULL; -fail: - av_frame_free(&in); - av_frame_free(&out); - return ret; -} - -static const AVFilterPad qp_inputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - .filter_frame = filter_frame, - .config_props = config_input, - }, - { NULL } -}; - -static const AVFilterPad qp_outputs[] = { - { - .name = "default", - .type = AVMEDIA_TYPE_VIDEO, - }, - { NULL } -}; - -AVFilter ff_vf_qp = { - .name = "qp", - .description = NULL_IF_CONFIG_SMALL("Change video quantization parameters."), - .priv_size = sizeof(QPContext), - .inputs = qp_inputs, - .outputs = qp_outputs, - .priv_class = &qp_class, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, -}; diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 2da27f714a..5f4fd75b40 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -531,21 +531,16 @@ fate-filter-idet: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf idet FATE_FILTER_VSYNTH-$(CONFIG_PAD_FILTER) += fate-filter-pad fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2" -FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp2 fate-filter-pp3 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6 +FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6 FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += $(FATE_FILTER_PP) $(FATE_FILTER_PP): fate-vsynth1-mpeg4-qprd fate-filter-pp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp=be/hb/vb/tn/l5/al" fate-filter-pp1: CMD = video_filter "pp=fq|4/be/hb/vb/tn/l5/al" -fate-filter-pp2: CMD = video_filter "qp=x+y,pp=be/h1/v1/lb" -fate-filter-pp3: CMD = video_filter "qp=x+y,pp=be/ha|128|7/va/li" fate-filter-pp4: CMD = video_filter "pp=be/ci" fate-filter-pp5: CMD = video_filter "pp=md" fate-filter-pp6: CMD = video_filter "pp=be/fd" -FATE_FILTER_VSYNTH-$(call ALLYES, QP_FILTER PP_FILTER) += fate-filter-qp -fate-filter-qp: CMD = video_filter "qp=17,pp=be/hb/vb/tn/l5/al" - FATE_FILTER_VSYNTH-$(CONFIG_SELECT_FILTER) += fate-filter-select fate-filter-select: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf "select=not(eq(mod(n\,2)\,0)+eq(mod(n\,3)\,0))" -frames:v 25 -flags +bitexact diff --git a/tests/ref/fate/filter-pp2 b/tests/ref/fate/filter-pp2 deleted file mode 100644 index ed5e77322a..0000000000 --- a/tests/ref/fate/filter-pp2 +++ /dev/null @@ -1 +0,0 @@ -pp2 566d48ad25dfa7a9680de933cbdf66d9 diff --git a/tests/ref/fate/filter-pp3 b/tests/ref/fate/filter-pp3 deleted file mode 100644 index 536bf8e9d2..0000000000 --- a/tests/ref/fate/filter-pp3 +++ /dev/null @@ -1 +0,0 @@ -pp3 586fc14a52699540a865c070dd113229 From patchwork Mon Feb 24 12:37: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: 17903 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 CB9C144A135 for ; Mon, 24 Feb 2020 14:39:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B125068B497; Mon, 24 Feb 2020 14:39:26 +0200 (EET) 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 ESMTP id 790E868B481 for ; Mon, 24 Feb 2020 14:39:19 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 1E80B2951A9 for ; Mon, 24 Feb 2020 13:39:19 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id ekn0qU4F48l2 for ; Mon, 24 Feb 2020 13:39:17 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (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 "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 11AB3295126 for ; Mon, 24 Feb 2020 13:39:17 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 8979825237 for ; Mon, 24 Feb 2020 13:39:16 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id gR-BdgE6dW4I for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 6B3A62522B for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 242C220E0356; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:31 +0100 Message-Id: <20200224123739.31154-5-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 04/12] vf_codecview: drop qp functionality 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" It depends on API that has been deprecated for five years and is of highly dubious usefulness. --- doc/filters.texi | 3 --- libavfilter/vf_codecview.c | 26 -------------------------- 2 files changed, 29 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 2a1235183f..43e52f930a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7182,9 +7182,6 @@ forward predicted MVs of B-frames backward predicted MVs of B-frames @end table -@item qp -Display quantization parameters using the chroma planes. - @item mv_type, mvt Set motion vectors type to visualize. Includes MVs from all frames unless specified by @var{frame_type} option. diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index 331bfba777..2657660b97 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -50,7 +50,6 @@ typedef struct CodecViewContext { unsigned frame_type; unsigned mv_type; int hsub, vsub; - int qp; } CodecViewContext; #define OFFSET(x) offsetof(CodecViewContext, x) @@ -62,7 +61,6 @@ static const AVOption codecview_options[] = { CONST("pf", "forward predicted MVs of P-frames", MV_P_FOR, "mv"), CONST("bf", "forward predicted MVs of B-frames", MV_B_FOR, "mv"), CONST("bb", "backward predicted MVs of B-frames", MV_B_BACK, "mv"), - { "qp", NULL, OFFSET(qp), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, .flags = FLAGS }, { "mv_type", "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" }, { "mvt", "set motion vectors type", OFFSET(mv_type), AV_OPT_TYPE_FLAGS, {.i64=0}, 0, INT_MAX, FLAGS, "mv_type" }, CONST("fp", "forward predicted MVs", MV_TYPE_FOR, "mv_type"), @@ -218,30 +216,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) CodecViewContext *s = ctx->priv; 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); - - if (qp_table) { - int x, y; - const int w = AV_CEIL_RSHIFT(frame->width, s->hsub); - const int h = AV_CEIL_RSHIFT(frame->height, s->vsub); - uint8_t *pu = frame->data[1]; - uint8_t *pv = frame->data[2]; - const int lzu = frame->linesize[1]; - const int lzv = frame->linesize[2]; - - 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; - pu[x] = pv[x] = qp; - } - pu += lzu; - pv += lzv; - } - } - } - if (s->mv || s->mv_type) { AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS); if (sd) { From patchwork Mon Feb 24 12:37:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17909 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 AC2A744A135 for ; Mon, 24 Feb 2020 14:39:33 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9698668B547; Mon, 24 Feb 2020 14:39:33 +0200 (EET) 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 ESMTP id 8538468B4EE for ; Mon, 24 Feb 2020 14:39:23 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 35D472951AB for ; Mon, 24 Feb 2020 13:39:23 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 4XkHBOVt0ORi for ; Mon, 24 Feb 2020 13:39:22 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id BADBF2951A8 for ; Mon, 24 Feb 2020 13:39:22 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 8B1E32522B for ; Mon, 24 Feb 2020 13:39:22 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id brSQ5FWRYSGV for ; Mon, 24 Feb 2020 13:39:20 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 725D82522F for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 3953A20E0357; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:32 +0100 Message-Id: <20200224123739.31154-6-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/12] vf_fspp: drop the option to use frame-attached QP tables 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" This API has been deprecated for five years. --- doc/filters.texi | 6 -- libavfilter/vf_fspp.c | 129 ++++++++++-------------------------------- libavfilter/vf_fspp.h | 3 - 3 files changed, 30 insertions(+), 108 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 43e52f930a..59571a7022 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -11382,18 +11382,12 @@ an integer in the range 4-5. Default value is @code{4}. @item qp Force a constant quantization parameter. It accepts an integer in range 0-63. -If not set, the filter will use the QP from the video stream (if available). @item strength Set filter strength. It accepts an integer in range -15 to 32. Lower values mean more details but also more artifacts, while higher values make the image smoother but also blurrier. Default value is @code{0} − PSNR optimal. -@item use_bframe_qp -Enable the use of the QP from the B-Frames if set to @code{1}. Using this -option may cause flicker since the B-Frames have often larger QP. Default is -@code{0} (not enabled). - @end table @section gblur diff --git a/libavfilter/vf_fspp.c b/libavfilter/vf_fspp.c index c6989046c4..b53ae337c9 100644 --- a/libavfilter/vf_fspp.c +++ b/libavfilter/vf_fspp.c @@ -48,7 +48,6 @@ static const AVOption fspp_options[] = { { "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 4}, 4, MAX_LEVEL, FLAGS }, { "qp", "force a constant quantizer parameter", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 64, FLAGS }, { "strength", "set filter strength", OFFSET(strength), AV_OPT_TYPE_INT, {.i64 = 0}, -15, 32, FLAGS }, - { "use_bframe_qp", "use B-frames' QP", OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL,{.i64 = 0}, 0, 1, FLAGS }, { NULL } }; @@ -148,15 +147,12 @@ static void mul_thrmat_c(int16_t *thr_adr_noq, int16_t *thr_adr, int q) static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, - int width, int height, - uint8_t *qp_store, int qp_stride, int is_luma) + int width, int height, int is_luma) { - int x, x0, y, es, qy, t; + int x, x0, y, es; const int stride = is_luma ? p->temp_stride : (width + 16); const int step = 6 - p->log2_count; - const int qpsh = 4 - p->hsub * !is_luma; - const int qpsv = 4 - p->vsub * !is_luma; DECLARE_ALIGNED(32, int32_t, block_align)[4 * 8 * BLOCKSZ + 4 * 8 * BLOCKSZ]; int16_t *block = (int16_t *)block_align; @@ -186,31 +182,14 @@ static void filter(FSPPContext *p, uint8_t *dst, uint8_t *src, for (y = step; y < height + 8; y += step) { //step= 1,2 const int y1 = y - 8 + step; //l5-7 l4-6; - qy = y - 4; - if (qy > height - 1) qy = height - 1; - if (qy < 0) qy = 0; - - qy = (qy >> qpsv) * qp_stride; p->row_fdct(block, p->src + y * stride + 2 - (y&1), stride, 2); for (x0 = 0; x0 < width + 8 - 8 * (BLOCKSZ - 1); x0 += 8 * (BLOCKSZ - 1)) { p->row_fdct(block + 8 * 8, p->src + y * stride + 8 + x0 + 2 - (y&1), stride, 2 * (BLOCKSZ - 1)); - if (p->qp) - p->column_fidct((int16_t *)(&p->threshold_mtx[0]), block + 0 * 8, block3 + 0 * 8, 8 * (BLOCKSZ - 1)); //yes, this is a HOTSPOT - else - for (x = 0; x < 8 * (BLOCKSZ - 1); x += 8) { - t = x + x0 - 2; //correct t=x+x0-2-(y&1), but its the same - - if (t < 0) t = 0; //t always < width-2 - - t = qp_store[qy + (t >> qpsh)]; - t = ff_norm_qscale(t, p->qscale_type); + p->column_fidct((int16_t *)(&p->threshold_mtx[0]), block + 0 * 8, block3 + 0 * 8, 8 * (BLOCKSZ - 1)); //yes, this is a HOTSPOT - if (t != p->prev_q) p->prev_q = t, p->mul_thrmat((int16_t *)(&p->threshold_mtx_noq[0]), (int16_t *)(&p->threshold_mtx[0]), t); - p->column_fidct((int16_t *)(&p->threshold_mtx[0]), block + x * 8, block3 + x * 8, 8); //yes, this is a HOTSPOT - } p->row_idct(block3 + 0 * 8, p->temp + (y & 15) * stride + x0 + 2 - (y & 1), stride, 2 * (BLOCKSZ - 1)); memmove(block, block + (BLOCKSZ - 1) * 64, 8 * 8 * sizeof(int16_t)); //cycling memmove(block3, block3 + (BLOCKSZ - 1) * 64, 6 * 8 * sizeof(int16_t)); @@ -525,13 +504,6 @@ static int config_input(AVFilterLink *inlink) if (!fspp->temp || !fspp->src) return AVERROR(ENOMEM); - if (!fspp->use_bframe_qp && !fspp->qp) { - fspp->non_b_qp_alloc_size = AV_CEIL_RSHIFT(inlink->w, 4) * AV_CEIL_RSHIFT(inlink->h, 4); - fspp->non_b_qp_table = av_calloc(fspp->non_b_qp_alloc_size, sizeof(*fspp->non_b_qp_table)); - if (!fspp->non_b_qp_table) - return AVERROR(ENOMEM); - } - fspp->store_slice = store_slice_c; fspp->store_slice2 = store_slice2_c; fspp->mul_thrmat = mul_thrmat_c; @@ -552,8 +524,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = in; - int qp_stride = 0; - uint8_t *qp_table = NULL; int i, bias; int custom_threshold_m[64]; @@ -574,75 +544,37 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |(((uint64_t)custom_threshold_m[i * 8 + 7]) << 48); } - if (fspp->qp) - fspp->prev_q = fspp->qp, fspp->mul_thrmat((int16_t *)(&fspp->threshold_mtx_noq[0]), (int16_t *)(&fspp->threshold_mtx[0]), fspp->qp); - - /* if we are not in a constant user quantizer mode and we don't want to use - * the quantizers from the B-frames (B-frames often have a higher QP), we - * need to save the qp table from the last non B-frame; this is what the - * following code block does */ - if (!fspp->qp) { - qp_table = av_frame_get_qp_table(in, &qp_stride, &fspp->qscale_type); - - if (qp_table && !fspp->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) { - int w, h; - - /* if the qp stride is not set, it means the QP are only defined on - * a line basis */ - if (!qp_stride) { - w = AV_CEIL_RSHIFT(inlink->w, 4); - h = 1; - } else { - w = qp_stride; - h = AV_CEIL_RSHIFT(inlink->h, 4); - } - if (w * h > fspp->non_b_qp_alloc_size) { - int ret = av_reallocp_array(&fspp->non_b_qp_table, w, h); - if (ret < 0) { - fspp->non_b_qp_alloc_size = 0; - return ret; - } - fspp->non_b_qp_alloc_size = w * h; - } - - av_assert0(w * h <= fspp->non_b_qp_alloc_size); - memcpy(fspp->non_b_qp_table, qp_table, w * h); - } - } + fspp->prev_q = fspp->qp; + fspp->mul_thrmat((int16_t *)(&fspp->threshold_mtx_noq[0]), (int16_t *)(&fspp->threshold_mtx[0]), fspp->qp); if (fspp->log2_count && !ctx->is_disabled) { - if (!fspp->use_bframe_qp && fspp->non_b_qp_table) - qp_table = fspp->non_b_qp_table; - - if (qp_table || fspp->qp) { - const int cw = AV_CEIL_RSHIFT(inlink->w, fspp->hsub); - const int ch = AV_CEIL_RSHIFT(inlink->h, fspp->vsub); - - /* get a new frame if in-place is not possible or if the dimensions - * are not multiple of 8 */ - if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { - const int aligned_w = FFALIGN(inlink->w, 8); - const int aligned_h = FFALIGN(inlink->h, 8); - - out = ff_get_video_buffer(outlink, aligned_w, aligned_h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - out->width = in->width; - out->height = in->height; + const int cw = AV_CEIL_RSHIFT(inlink->w, fspp->hsub); + const int ch = AV_CEIL_RSHIFT(inlink->h, fspp->vsub); + + /* get a new frame if in-place is not possible or if the dimensions + * are not multiple of 8 */ + if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { + const int aligned_w = FFALIGN(inlink->w, 8); + const int aligned_h = FFALIGN(inlink->h, 8); + + out = ff_get_video_buffer(outlink, aligned_w, aligned_h); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); } - - filter(fspp, out->data[0], in->data[0], out->linesize[0], in->linesize[0], - inlink->w, inlink->h, qp_table, qp_stride, 1); - filter(fspp, out->data[1], in->data[1], out->linesize[1], in->linesize[1], - cw, ch, qp_table, qp_stride, 0); - filter(fspp, out->data[2], in->data[2], out->linesize[2], in->linesize[2], - cw, ch, qp_table, qp_stride, 0); - emms_c(); + av_frame_copy_props(out, in); + out->width = in->width; + out->height = in->height; } - } + + filter(fspp, out->data[0], in->data[0], out->linesize[0], in->linesize[0], + inlink->w, inlink->h, 1); + filter(fspp, out->data[1], in->data[1], out->linesize[1], in->linesize[1], + cw, ch, 0); + filter(fspp, out->data[2], in->data[2], out->linesize[2], in->linesize[2], + cw, ch, 0); + emms_c(); +} if (in != out) { if (in->data[3]) @@ -659,7 +591,6 @@ static av_cold void uninit(AVFilterContext *ctx) FSPPContext *fspp = ctx->priv; av_freep(&fspp->temp); av_freep(&fspp->src); - av_freep(&fspp->non_b_qp_table); } static const AVFilterPad fspp_inputs[] = { diff --git a/libavfilter/vf_fspp.h b/libavfilter/vf_fspp.h index 73d8c7c771..c2595d1a6b 100644 --- a/libavfilter/vf_fspp.h +++ b/libavfilter/vf_fspp.h @@ -65,9 +65,6 @@ typedef struct FSPPContext { int prev_q; uint8_t *src; int16_t *temp; - uint8_t *non_b_qp_table; - int non_b_qp_alloc_size; - int use_bframe_qp; void (*store_slice)(uint8_t *dst, int16_t *src, ptrdiff_t dst_stride, ptrdiff_t src_stride, From patchwork Mon Feb 24 12:37:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17906 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 6CD2544A135 for ; Mon, 24 Feb 2020 14:39:30 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 57FBF68B507; Mon, 24 Feb 2020 14:39:30 +0200 (EET) 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 ESMTP id 8BCF268B49E for ; Mon, 24 Feb 2020 14:39:25 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 69FE72951A7 for ; Mon, 24 Feb 2020 13:39:25 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 214Df17IaFos for ; Mon, 24 Feb 2020 13:39:25 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 08120295126 for ; Mon, 24 Feb 2020 13:39:25 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id C30A82522B for ; Mon, 24 Feb 2020 13:39:24 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id jxLuO5rQI1Ot for ; Mon, 24 Feb 2020 13:39:23 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 7586C25232 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 4974A20E0358; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:33 +0100 Message-Id: <20200224123739.31154-7-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/12] vf_pp: drop the option to use frame-attached QP tables 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" This API has been deprecated for five years. --- libavfilter/vf_pp.c | 8 ++------ tests/fate/filter-video.mak | 3 +-- tests/ref/fate/filter-pp | 10 ---------- 3 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 tests/ref/fate/filter-pp diff --git a/libavfilter/vf_pp.c b/libavfilter/vf_pp.c index 524ef1bb0a..efc558db8a 100644 --- a/libavfilter/vf_pp.c +++ b/libavfilter/vf_pp.c @@ -126,8 +126,6 @@ static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf) const int aligned_w = FFALIGN(outlink->w, 8); const int aligned_h = FFALIGN(outlink->h, 8); AVFrame *outbuf; - int qstride, qp_type; - int8_t *qp_table ; outbuf = ff_get_video_buffer(outlink, aligned_w, aligned_h); if (!outbuf) { @@ -137,16 +135,14 @@ static int pp_filter_frame(AVFilterLink *inlink, AVFrame *inbuf) av_frame_copy_props(outbuf, inbuf); outbuf->width = inbuf->width; outbuf->height = inbuf->height; - qp_table = av_frame_get_qp_table(inbuf, &qstride, &qp_type); pp_postprocess((const uint8_t **)inbuf->data, inbuf->linesize, outbuf->data, outbuf->linesize, aligned_w, outlink->h, - qp_table, - qstride, + NULL, 0, pp->modes[pp->mode_id], pp->pp_ctx, - outbuf->pict_type | (qp_type ? PP_PICT_TYPE_QP2 : 0)); + outbuf->pict_type); av_frame_free(&inbuf); return ff_filter_frame(outlink, outbuf); diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 5f4fd75b40..c7b60ed94a 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -531,11 +531,10 @@ fate-filter-idet: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf idet FATE_FILTER_VSYNTH-$(CONFIG_PAD_FILTER) += fate-filter-pad fate-filter-pad: CMD = video_filter "pad=iw*1.5:ih*1.5:iw*0.3:ih*0.2" -FATE_FILTER_PP = fate-filter-pp fate-filter-pp1 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6 +FATE_FILTER_PP = fate-filter-pp1 fate-filter-pp4 fate-filter-pp5 fate-filter-pp6 FATE_FILTER_VSYNTH-$(CONFIG_PP_FILTER) += $(FATE_FILTER_PP) $(FATE_FILTER_PP): fate-vsynth1-mpeg4-qprd -fate-filter-pp: CMD = framecrc -flags bitexact -idct simple -i $(TARGET_PATH)/tests/data/fate/vsynth1-mpeg4-qprd.avi -frames:v 5 -flags +bitexact -vf "pp=be/hb/vb/tn/l5/al" fate-filter-pp1: CMD = video_filter "pp=fq|4/be/hb/vb/tn/l5/al" fate-filter-pp4: CMD = video_filter "pp=be/ci" fate-filter-pp5: CMD = video_filter "pp=md" diff --git a/tests/ref/fate/filter-pp b/tests/ref/fate/filter-pp deleted file mode 100644 index 5c0e2994c6..0000000000 --- a/tests/ref/fate/filter-pp +++ /dev/null @@ -1,10 +0,0 @@ -#tb 0: 1/25 -#media_type 0: video -#codec_id 0: rawvideo -#dimensions 0: 352x288 -#sar 0: 1/1 -0, 1, 1, 1, 152064, 0x0af8a873 -0, 2, 2, 1, 152064, 0xaeb99897 -0, 3, 3, 1, 152064, 0x8f3712c8 -0, 4, 4, 1, 152064, 0x5bf6a64c -0, 5, 5, 1, 152064, 0x262de352 From patchwork Mon Feb 24 12:37:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17905 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 8827644A135 for ; Mon, 24 Feb 2020 14:39:28 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7600968B490; Mon, 24 Feb 2020 14:39:28 +0200 (EET) 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 ESMTP id E1CFE68B3E7 for ; Mon, 24 Feb 2020 14:39:24 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 5D7962951AC for ; Mon, 24 Feb 2020 13:39:24 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id w5fkNTn5HuZb for ; Mon, 24 Feb 2020 13:39:24 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id EFDB02951A8 for ; Mon, 24 Feb 2020 13:39:23 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id AA6282522B for ; Mon, 24 Feb 2020 13:39:23 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id AK4CdeL0F9mJ for ; Mon, 24 Feb 2020 13:39:22 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 732C325230 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 5E7FA20E0359; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:34 +0100 Message-Id: <20200224123739.31154-8-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/12] vf_pp7: drop the option to use frame-attached QP tables 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" This API has been deprecated for five years. --- doc/filters.texi | 3 +-- libavfilter/vf_pp7.c | 34 ++++++++++------------------------ 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 59571a7022..3b1470ed0f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -15047,8 +15047,7 @@ The filter accepts the following options: @table @option @item qp Force a constant quantization parameter. It accepts an integer in range -0 to 63. If not set, the filter will use the QP from the video stream -(if available). +0 to 63. @item mode Set thresholding mode. Available modes are: diff --git a/libavfilter/vf_pp7.c b/libavfilter/vf_pp7.c index 570a1c90b9..97f5b459cd 100644 --- a/libavfilter/vf_pp7.c +++ b/libavfilter/vf_pp7.c @@ -200,7 +200,7 @@ static int softthresh_c(PP7Context *p, int16_t *src, int qp) static void filter(PP7Context *p, uint8_t *dst, uint8_t *src, int dst_stride, int src_stride, int width, int height, - uint8_t *qp_store, int qp_stride, int is_luma) + int is_luma) { int x, y; const int stride = is_luma ? p->temp_stride : ((width + 16 + 15) & (~15)); @@ -232,16 +232,11 @@ static void filter(PP7Context *p, uint8_t *dst, uint8_t *src, dctA_c(tp + 4 * 8, src, stride); } for (x = 0; x < width; ) { - const int qps = 3 + is_luma; int qp; int end = FFMIN(x + 8, width); - if (p->qp) - qp = p->qp; - else { - qp = qp_store[ (FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride]; - qp = ff_norm_qscale(qp, p->qscale_type); - } + qp = p->qp; + for (; x < end; x++) { const int index = x + y * stride + (8 - 3) * (1 + stride) + 8; //FIXME silly offset uint8_t *src = p_src + index; @@ -321,12 +316,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = in; - int qp_stride = 0; - uint8_t *qp_table = NULL; - - if (!pp7->qp) - qp_table = av_frame_get_qp_table(in, &qp_stride, &pp7->qscale_type); - if (!ctx->is_disabled) { const int cw = AV_CEIL_RSHIFT(inlink->w, pp7->hsub); const int ch = AV_CEIL_RSHIFT(inlink->h, pp7->vsub); @@ -347,16 +336,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) out->height = in->height; } - if (qp_table || pp7->qp) { - - filter(pp7, out->data[0], in->data[0], out->linesize[0], in->linesize[0], - inlink->w, inlink->h, qp_table, qp_stride, 1); - filter(pp7, out->data[1], in->data[1], out->linesize[1], in->linesize[1], - cw, ch, qp_table, qp_stride, 0); - filter(pp7, out->data[2], in->data[2], out->linesize[2], in->linesize[2], - cw, ch, qp_table, qp_stride, 0); - emms_c(); - } + filter(pp7, out->data[0], in->data[0], out->linesize[0], in->linesize[0], + inlink->w, inlink->h, 1); + filter(pp7, out->data[1], in->data[1], out->linesize[1], in->linesize[1], + cw, ch, 0); + filter(pp7, out->data[2], in->data[2], out->linesize[2], in->linesize[2], + cw, ch, 0); + emms_c(); } if (in != out) { From patchwork Mon Feb 24 12:37:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17907 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 5D9C044A135 for ; Mon, 24 Feb 2020 14:39:31 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F86968B522; Mon, 24 Feb 2020 14:39:31 +0200 (EET) 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 ESMTP id 6FF9568B4A2 for ; Mon, 24 Feb 2020 14:39:27 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id 3A8F12951A9 for ; Mon, 24 Feb 2020 13:39:27 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 8c2L00KE3zrE for ; Mon, 24 Feb 2020 13:39:26 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id C3B752951A8 for ; Mon, 24 Feb 2020 13:39:26 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 835D42522B for ; Mon, 24 Feb 2020 13:39:26 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id xnkTe3OJfcNo for ; Mon, 24 Feb 2020 13:39:24 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 758B625231 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 6E13C20E035A; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:35 +0100 Message-Id: <20200224123739.31154-9-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/12] vf_spp: drop the option to use frame-attached QP tables 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" This API has been deprecated for five years. --- doc/filters.texi | 7 +-- libavfilter/vf_spp.c | 100 +++++++++++-------------------------------- libavfilter/vf_spp.h | 3 -- 3 files changed, 26 insertions(+), 84 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 3b1470ed0f..5fa1663426 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -17221,8 +17221,7 @@ that value the speed drops by a factor of approximately 2. Default value is @code{3}. @item qp -Force a constant quantization parameter. If not set, the filter will use the QP -from the video stream (if available). +Force a constant quantization parameter. @item mode Set thresholding mode. Available modes are: @@ -17234,10 +17233,6 @@ Set hard thresholding (default). Set soft thresholding (better de-ringing effect, but likely blurrier). @end table -@item use_bframe_qp -Enable the use of the QP from the B-Frames if set to @code{1}. Using this -option may cause flicker since the B-Frames have often larger QP. Default is -@code{0} (not enabled). @end table @subsection Commands diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c index 7381938f7f..ba6138f08e 100644 --- a/libavfilter/vf_spp.c +++ b/libavfilter/vf_spp.c @@ -64,7 +64,6 @@ static const AVOption spp_options[] = { { "mode", "set thresholding mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64 = MODE_HARD}, 0, NB_MODES - 1, FLAGS, "mode" }, { "hard", "hard thresholding", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_HARD}, INT_MIN, INT_MAX, FLAGS, "mode" }, { "soft", "soft thresholding", 0, AV_OPT_TYPE_CONST, {.i64 = MODE_SOFT}, INT_MIN, INT_MAX, FLAGS, "mode" }, - { "use_bframe_qp", "use B-frames' QP", OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, { NULL } }; @@ -232,7 +231,7 @@ static inline void add_block(uint16_t *dst, int linesize, const int16_t block[64 static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, int dst_linesize, int src_linesize, int width, int height, - const uint8_t *qp_table, int qp_stride, int is_luma, int depth) + int is_luma, int depth) { int x, y, i; const int count = 1 << p->log2_count; @@ -266,15 +265,8 @@ static void filter(SPPContext *p, uint8_t *dst, uint8_t *src, for (y = 0; y < height + 8; y += 8) { memset(p->temp + (8 + y) * linesize, 0, 8 * linesize * sizeof(*p->temp)); for (x = 0; x < width + 8; x += 8) { - int qp; - - if (p->qp) { - qp = p->qp; - } else{ - const int qps = 3 + is_luma; - qp = qp_table[(FFMIN(x, width - 1) >> qps) + (FFMIN(y, height - 1) >> qps) * qp_stride]; - qp = FFMAX(1, ff_norm_qscale(qp, p->qscale_type)); - } + int qp = p->qp; + for (i = 0; i < count; i++) { const int x1 = x + offset[i + count - 1][0]; const int y1 = y + offset[i + count - 1][1]; @@ -357,77 +349,36 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) SPPContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = in; - int qp_stride = 0; - const int8_t *qp_table = NULL; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); const int depth = desc->comp[0].depth; - /* if we are not in a constant user quantizer mode and we don't want to use - * the quantizers from the B-frames (B-frames often have a higher QP), we - * need to save the qp table from the last non B-frame; this is what the - * following code block does */ - if (!s->qp) { - qp_table = av_frame_get_qp_table(in, &qp_stride, &s->qscale_type); - - if (qp_table && !s->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) { - int w, h; - - /* if the qp stride is not set, it means the QP are only defined on - * a line basis */ - if (!qp_stride) { - w = AV_CEIL_RSHIFT(inlink->w, 4); - h = 1; - } else { - w = qp_stride; - h = AV_CEIL_RSHIFT(inlink->h, 4); - } - - if (w * h > s->non_b_qp_alloc_size) { - int ret = av_reallocp_array(&s->non_b_qp_table, w, h); - if (ret < 0) { - s->non_b_qp_alloc_size = 0; - return ret; - } - s->non_b_qp_alloc_size = w * h; - } - - av_assert0(w * h <= s->non_b_qp_alloc_size); - memcpy(s->non_b_qp_table, qp_table, w * h); - } - } - if (s->log2_count && !ctx->is_disabled) { - if (!s->use_bframe_qp && s->non_b_qp_table) - qp_table = s->non_b_qp_table; - - if (qp_table || s->qp) { - const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub); - const int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub); - - /* get a new frame if in-place is not possible or if the dimensions - * are not multiple of 8 */ - if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { - const int aligned_w = FFALIGN(inlink->w, 8); - const int aligned_h = FFALIGN(inlink->h, 8); - - out = ff_get_video_buffer(outlink, aligned_w, aligned_h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - out->width = in->width; - out->height = in->height; + const int cw = AV_CEIL_RSHIFT(inlink->w, s->hsub); + const int ch = AV_CEIL_RSHIFT(inlink->h, s->vsub); + + /* get a new frame if in-place is not possible or if the dimensions + * are not multiple of 8 */ + if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { + const int aligned_w = FFALIGN(inlink->w, 8); + const int aligned_h = FFALIGN(inlink->h, 8); + + out = ff_get_video_buffer(outlink, aligned_w, aligned_h); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); } + av_frame_copy_props(out, in); + out->width = in->width; + out->height = in->height; + } - filter(s, out->data[0], in->data[0], out->linesize[0], in->linesize[0], inlink->w, inlink->h, qp_table, qp_stride, 1, depth); + filter(s, out->data[0], in->data[0], out->linesize[0], in->linesize[0], inlink->w, inlink->h, 1, depth); - if (out->data[2]) { - filter(s, out->data[1], in->data[1], out->linesize[1], in->linesize[1], cw, ch, qp_table, qp_stride, 0, depth); - filter(s, out->data[2], in->data[2], out->linesize[2], in->linesize[2], cw, ch, qp_table, qp_stride, 0, depth); - } - emms_c(); + if (out->data[2]) { + filter(s, out->data[1], in->data[1], out->linesize[1], in->linesize[1], cw, ch, 0, depth); + filter(s, out->data[2], in->data[2], out->linesize[2], in->linesize[2], cw, ch, 0, depth); } + emms_c(); } if (in != out) { @@ -494,7 +445,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&s->avctx); } av_freep(&s->dct); - av_freep(&s->non_b_qp_table); } static const AVFilterPad spp_inputs[] = { diff --git a/libavfilter/vf_spp.h b/libavfilter/vf_spp.h index c03073a4e1..f038201e53 100644 --- a/libavfilter/vf_spp.h +++ b/libavfilter/vf_spp.h @@ -40,9 +40,6 @@ typedef struct SPPContext { uint16_t *temp; AVCodecContext *avctx; AVDCT *dct; - int8_t *non_b_qp_table; - int non_b_qp_alloc_size; - int use_bframe_qp; int hsub, vsub; void (*store_slice)(uint8_t *dst, const int16_t *src, From patchwork Mon Feb 24 12:37:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17910 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 A212444A135 for ; Mon, 24 Feb 2020 14:39:34 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9383168B569; Mon, 24 Feb 2020 14:39:34 +0200 (EET) 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 ESMTP id 1EA6E68B4F3 for ; Mon, 24 Feb 2020 14:39:29 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id B78DC2951A7 for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id k3fVo16JT1Eo for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 49D66295126 for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 072D52522B for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IIqXIni3G6uU for ; Mon, 24 Feb 2020 13:39:26 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 7700025233 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 7C4DA20E035B; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:36 +0100 Message-Id: <20200224123739.31154-10-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 09/12] vf_uspp: drop the option to use frame-attached QP tables 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" This API has been deprecated for five years. --- doc/filters.texi | 3 +- libavfilter/vf_uspp.c | 94 +++++++++---------------------------------- 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 5fa1663426..4d17330df5 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -18724,8 +18724,7 @@ that value the speed drops by a factor of approximately 2. Default value is @code{3}. @item qp -Force a constant quantization parameter. If not set, the filter will use the QP -from the video stream (if available). +Force a constant quantization parameter. @end table @section v360 diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c index da4029f4b2..677eeff276 100644 --- a/libavfilter/vf_uspp.c +++ b/libavfilter/vf_uspp.c @@ -51,9 +51,6 @@ typedef struct USPPContext { AVCodecContext *avctx_enc[BLOCK*BLOCK]; AVFrame *frame; AVFrame *frame_dec; - uint8_t *non_b_qp_table; - int non_b_qp_alloc_size; - int use_bframe_qp; } USPPContext; #define OFFSET(x) offsetof(USPPContext, x) @@ -61,7 +58,6 @@ typedef struct USPPContext { static const AVOption uspp_options[] = { { "quality", "set quality", OFFSET(log2_count), AV_OPT_TYPE_INT, {.i64 = 3}, 0, MAX_LEVEL, FLAGS }, { "qp", "force a constant quantizer parameter", OFFSET(qp), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 63, FLAGS }, - { "use_bframe_qp", "use B-frames' QP", OFFSET(use_bframe_qp), AV_OPT_TYPE_BOOL,{.i64 = 0}, 0, 1, FLAGS }, { NULL } }; @@ -182,7 +178,7 @@ static void store_slice_c(uint8_t *dst, const uint16_t *src, static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3], int dst_stride[3], int src_stride[3], int width, - int height, uint8_t *qp_store, int qp_stride) + int height) { int x, y, i, j; const int count = 1<log2_count; @@ -215,18 +211,8 @@ static void filter(USPPContext *p, uint8_t *dst[3], uint8_t *src[3], memset(p->temp[i], 0, (h + 2 * block) * stride * sizeof(int16_t)); } - if (p->qp) - p->frame->quality = p->qp * FF_QP2LAMBDA; - else { - int qpsum=0; - int qpcount = (height>>4) * (height>>4); + p->frame->quality = p->qp * FF_QP2LAMBDA; - for (y = 0; y < (height>>4); y++) { - for (x = 0; x < (width>>4); x++) - qpsum += qp_store[x + y * qp_stride]; - } - p->frame->quality = ff_norm_qscale((qpsum + qpcount/2) / qpcount, p->qscale_type) * FF_QP2LAMBDA; - } // init per MB qscale stuff FIXME p->frame->height = height + BLOCK; p->frame->width = width + BLOCK; @@ -384,68 +370,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) AVFilterLink *outlink = ctx->outputs[0]; AVFrame *out = in; - int qp_stride = 0; - uint8_t *qp_table = NULL; - - /* if we are not in a constant user quantizer mode and we don't want to use - * the quantizers from the B-frames (B-frames often have a higher QP), we - * need to save the qp table from the last non B-frame; this is what the - * following code block does */ - if (!uspp->qp) { - qp_table = av_frame_get_qp_table(in, &qp_stride, &uspp->qscale_type); - - if (qp_table && !uspp->use_bframe_qp && in->pict_type != AV_PICTURE_TYPE_B) { - int w, h; - - /* if the qp stride is not set, it means the QP are only defined on - * a line basis */ - if (!qp_stride) { - w = AV_CEIL_RSHIFT(inlink->w, 4); - h = 1; - } else { - w = qp_stride; - h = AV_CEIL_RSHIFT(inlink->h, 4); - } - - if (w * h > uspp->non_b_qp_alloc_size) { - int ret = av_reallocp_array(&uspp->non_b_qp_table, w, h); - if (ret < 0) { - uspp->non_b_qp_alloc_size = 0; - return ret; - } - uspp->non_b_qp_alloc_size = w * h; - } - - av_assert0(w * h <= uspp->non_b_qp_alloc_size); - memcpy(uspp->non_b_qp_table, qp_table, w * h); - } - } - if (uspp->log2_count && !ctx->is_disabled) { - if (!uspp->use_bframe_qp && uspp->non_b_qp_table) - qp_table = uspp->non_b_qp_table; - - if (qp_table || uspp->qp) { - - /* get a new frame if in-place is not possible or if the dimensions - * are not multiple of 8 */ - if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { - const int aligned_w = FFALIGN(inlink->w, 8); - const int aligned_h = FFALIGN(inlink->h, 8); - - out = ff_get_video_buffer(outlink, aligned_w, aligned_h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - out->width = in->width; - out->height = in->height; + /* get a new frame if in-place is not possible or if the dimensions + * are not multiple of 8 */ + if (!av_frame_is_writable(in) || (inlink->w & 7) || (inlink->h & 7)) { + const int aligned_w = FFALIGN(inlink->w, 8); + const int aligned_h = FFALIGN(inlink->h, 8); + + out = ff_get_video_buffer(outlink, aligned_w, aligned_h); + if (!out) { + av_frame_free(&in); + return AVERROR(ENOMEM); } - - filter(uspp, out->data, in->data, out->linesize, in->linesize, - inlink->w, inlink->h, qp_table, qp_stride); + av_frame_copy_props(out, in); + out->width = in->width; + out->height = in->height; } + + filter(uspp, out->data, in->data, out->linesize, in->linesize, + inlink->w, inlink->h); } if (in != out) { @@ -473,7 +416,6 @@ static av_cold void uninit(AVFilterContext *ctx) av_freep(&uspp->avctx_enc[i]); } - av_freep(&uspp->non_b_qp_table); av_freep(&uspp->outbuf); av_frame_free(&uspp->frame); } From patchwork Mon Feb 24 12:37:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17911 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 60BE944A135 for ; Mon, 24 Feb 2020 14:39:35 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 507A068B587; Mon, 24 Feb 2020 14:39:35 +0200 (EET) 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 ESMTP id 2002168B51C for ; Mon, 24 Feb 2020 14:39:30 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id EDA1D2951A7 for ; Mon, 24 Feb 2020 13:39:29 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Ze1PPw6FneeK for ; Mon, 24 Feb 2020 13:39:29 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 0C178295126 for ; Mon, 24 Feb 2020 13:39:29 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id C5FA92522B for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id r4PXOWWkDoy2 for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 8316E25234 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 8D31C20E0360; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:37 +0100 Message-Id: <20200224123739.31154-11-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 10/12] mjpegdec: stop exporting QP tables 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" This API has been deprecated for five years and is of highly dubious usefulness. --- libavcodec/mjpegdec.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index d5e7c21610..c535fd0fff 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -2508,19 +2508,11 @@ eoi_parser: *got_frame = 1; s->got_picture = 0; - if (!s->lossless) { + if (!s->lossless && (avctx->debug & FF_DEBUG_QP)) { int qp = FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]); - int qpw = (s->width + 15) / 16; - AVBufferRef *qp_table_buf = av_buffer_alloc(qpw); - if (qp_table_buf) { - memset(qp_table_buf->data, qp, qpw); - av_frame_set_qp_table(data, qp_table_buf, 0, FF_QSCALE_TYPE_MPEG1); - } - - if(avctx->debug & FF_DEBUG_QP) - av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp); + av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", qp); } goto the_end; From patchwork Mon Feb 24 12:37:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17912 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 3C85344A135 for ; Mon, 24 Feb 2020 14:39:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 299E368B58F; Mon, 24 Feb 2020 14:39:36 +0200 (EET) 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 ESMTP id 1FFA068B4F3 for ; Mon, 24 Feb 2020 14:39:31 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id C68AF2951A8 for ; Mon, 24 Feb 2020 13:39:30 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id uR2eJOSma_2N for ; Mon, 24 Feb 2020 13:39:30 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2a00:c500:61:23b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 56989295126 for ; Mon, 24 Feb 2020 13:39:30 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 24ECF2522B for ; Mon, 24 Feb 2020 13:39:30 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id nfKqCOPlfWeQ for ; Mon, 24 Feb 2020 13:39:28 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id 9027625235 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 9B07B20E0361; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:38 +0100 Message-Id: <20200224123739.31154-12-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/12] mpegvideo: stop exporting QP tables 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" This API has been deprecated for five years and is of highly dubious usefulness. --- libavcodec/h263dec.c | 2 -- libavcodec/mpeg12dec.c | 2 -- libavcodec/mpegvideo.c | 12 ------------ libavcodec/mpegvideo.h | 2 -- libavcodec/rv10.c | 2 -- libavcodec/rv34.c | 2 -- 6 files changed, 22 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 8ee844e298..9cad65e56b 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -693,12 +693,10 @@ frame_end: if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1); } if (s->last_picture_ptr || s->low_delay) { diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 17f9495a1d..124f86e459 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -2062,7 +2062,6 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (ret < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG2); } else { if (avctx->active_thread_type & FF_THREAD_FRAME) s->picture_number++; @@ -2073,7 +2072,6 @@ static int slice_end(AVCodecContext *avctx, AVFrame *pict) if (ret < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG2); } } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index dbb6ab9b39..55ca99f7b2 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1443,18 +1443,6 @@ void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict) s->mb_width, s->mb_height, s->mb_stride, s->quarter_sample); } -int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type) -{ - AVBufferRef *ref = av_buffer_ref(p->qscale_table_buf); - int offset = 2*s->mb_stride + 1; - if(!ref) - return AVERROR(ENOMEM); - av_assert0(ref->size >= offset + s->mb_stride * ((f->height+15)/16)); - ref->size -= offset; - ref->data += offset; - return av_frame_set_qp_table(f, ref, s->mb_stride, qp_type); -} - static inline int hpel_motion_lowres(MpegEncContext *s, uint8_t *dest, uint8_t *src, int field_based, int field_select, diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 29e692f245..06d27b32f2 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -713,8 +713,6 @@ void ff_mpeg_flush(AVCodecContext *avctx); void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict); -int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type); - void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 3b41d30b92..d958d3f8d1 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -772,12 +772,10 @@ static int rv10_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1); } if (s->last_picture_ptr || s->low_delay) { diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index d171e6e1bd..57557f537a 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1617,13 +1617,11 @@ static int finish_frame(AVCodecContext *avctx, AVFrame *pict) if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1); got_picture = 1; } else if (s->last_picture_ptr) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr, pict); - ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1); got_picture = 1; } From patchwork Mon Feb 24 12:37:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 17913 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 1C93E44A135 for ; Mon, 24 Feb 2020 14:39:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0662868B53D; Mon, 24 Feb 2020 14:39:37 +0200 (EET) 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 ESMTP id EBB0C68B3E7 for ; Mon, 24 Feb 2020 14:39:31 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id BE9182951A7 for ; Mon, 24 Feb 2020 13:39:31 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id UtlyKPxozCwl for ; Mon, 24 Feb 2020 13:39:31 +0100 (CET) Received: from quelana.khirnov.net (unknown [IPv6:2002:b061:f0a:201:5e:e696:5100:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "quelana.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id 545A9295126 for ; Mon, 24 Feb 2020 13:39:31 +0100 (CET) Received: from localhost (quelana.khirnov.net [IPv6:::1]) by quelana.khirnov.net (Postfix) with ESMTP id 237242522B for ; Mon, 24 Feb 2020 13:39:31 +0100 (CET) Received: from quelana.khirnov.net ([IPv6:::1]) by localhost (quelana.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 3oyyDFGWlFVf for ; Mon, 24 Feb 2020 13:39:30 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) by quelana.khirnov.net (Postfix) with ESMTP id A273E25236 for ; Mon, 24 Feb 2020 13:39:14 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id A8B0020E0362; Mon, 24 Feb 2020 13:39:11 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Feb 2020 13:37:39 +0100 Message-Id: <20200224123739.31154-13-anton@khirnov.net> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200224123739.31154-1-anton@khirnov.net> References: <20200224123739.31154-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 12/12] Add missing stddef.h includes for size_t. 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" --- libavutil/hash.c | 2 ++ libavutil/hash.h | 1 + libavutil/murmur3.c | 2 ++ libavutil/murmur3.h | 1 + libavutil/ripemd.c | 1 + libavutil/ripemd.h | 1 + 6 files changed, 8 insertions(+) diff --git a/libavutil/hash.c b/libavutil/hash.c index 75edb6db78..d626c31181 100644 --- a/libavutil/hash.c +++ b/libavutil/hash.c @@ -17,6 +17,8 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include #include #include "hash.h" diff --git a/libavutil/hash.h b/libavutil/hash.h index 7693e6bf0d..af4719e423 100644 --- a/libavutil/hash.h +++ b/libavutil/hash.h @@ -27,6 +27,7 @@ #ifndef AVUTIL_HASH_H #define AVUTIL_HASH_H +#include #include #include "version.h" diff --git a/libavutil/murmur3.c b/libavutil/murmur3.c index 7961752515..3e85c3c94f 100644 --- a/libavutil/murmur3.c +++ b/libavutil/murmur3.c @@ -17,6 +17,8 @@ * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ + +#include #include #include "mem.h" #include "intreadwrite.h" diff --git a/libavutil/murmur3.h b/libavutil/murmur3.h index 1b09175c1e..b3b3a07de2 100644 --- a/libavutil/murmur3.h +++ b/libavutil/murmur3.h @@ -27,6 +27,7 @@ #ifndef AVUTIL_MURMUR3_H #define AVUTIL_MURMUR3_H +#include #include #include "version.h" diff --git a/libavutil/ripemd.c b/libavutil/ripemd.c index 4f1c4ea899..89d69cc23d 100644 --- a/libavutil/ripemd.c +++ b/libavutil/ripemd.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include "attributes.h" diff --git a/libavutil/ripemd.h b/libavutil/ripemd.h index 0db6858ff3..921aa66684 100644 --- a/libavutil/ripemd.h +++ b/libavutil/ripemd.h @@ -28,6 +28,7 @@ #ifndef AVUTIL_RIPEMD_H #define AVUTIL_RIPEMD_H +#include #include #include "attributes.h"