From patchwork Thu Jun 7 23:43:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Thompson X-Patchwork-Id: 9289 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:11c:0:0:0:0:0 with SMTP id c28-v6csp193102jad; Thu, 7 Jun 2018 16:45:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJeGGUoRAKuwqSmU26zH3O0J43FWCzzsjG4iPcX7j8kXIlC/ggw63M3q6lDRTNi/Rn4iQU4 X-Received: by 2002:a1c:8941:: with SMTP id l62-v6mr2821020wmd.26.1528415103465; Thu, 07 Jun 2018 16:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528415103; cv=none; d=google.com; s=arc-20160816; b=JEEI8qbEmTqFV1/AhdhdnOF6KKlEosPH6yJOkxnNlkZl3drNKjBGmgInVQRjD5r8CG MUYKt3JSI/iDr3YQW3HGLQoOKodNB6j7iOEG0Li33b0e8nisn63SK7GZwrKOYLNARx6k t1f2WxfBrO60e3RvKHsEeJxFVb1R5m/K82bXkduqb+VT/ygb7Gl7G2qBNH0s44bFVPAj KtX6Xu7c2e/raex9ClBHoA0q9IsTfgRW6nVVT6mZmBAmtqscUUPievCbGBXCCsu1x0id vLCqbVe9evHrj0nBESE8gSd2GMdebktsqUKcLWWBtOiZcT7X8v3j0KLlmzI46M+K3heW xdMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=3LTd2oNcPHr3g44WC7ZMP+GyAHZ9K/4oueGM48ZnJt8=; b=j9bsTJvJi2nfz08b5yvhuBomJuVy/NO5Z3s5oizgOqcM/L8fNtwweclWBxeutwHLFW YcwlZfCC3IsUkfuCZwQJEuQax7eeCV+HSLWP+qMJ/1bIS9JEbn3Lk1ESBq0ZbS8UhwAu dhdn9dgU7A5nYUgJpMCF+FTAlVcJ7S52OrhzfEqsodfDU/Y2uRIwMWfDikdkHwy4TA7e ABgzZp2eGL9euSKeMU0Ci9MEYUB3bcSa344Z7QnrQ9+k/yz0/9fX77rWoQamxOFXdg9B LarvZx+dE5kdXW75EBUoZoXuMY1sEMAZ+11g6+M63g651q0+ODzKFm3t8VhoTDi1R4So RQjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=0y8OTx5g; 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 f13-v6si10366792wrj.147.2018.06.07.16.45.03; Thu, 07 Jun 2018 16:45:03 -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; dkim=neutral (body hash did not verify) header.i=@jkqxz-net.20150623.gappssmtp.com header.s=20150623 header.b=0y8OTx5g; 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 D479D68A519; Fri, 8 Jun 2018 02:43:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f46.google.com (mail-wm0-f46.google.com [74.125.82.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1A46068A643 for ; Fri, 8 Jun 2018 02:42:58 +0300 (EEST) Received: by mail-wm0-f46.google.com with SMTP id e16-v6so253618wmd.0 for ; Thu, 07 Jun 2018 16:43:45 -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; bh=8D3TSepyyZ92NiERBV+pM7P7+jER/TFerYfhPgxRmT8=; b=0y8OTx5g4y05wOqkkFmSfXhJDLRseo/YmEyB/FD3Qxq4qvMOdu42G3BBT6+JyeMJoR SqO4arnZpvGGiLSYS8OFEPJOlxCsWvcpVszrqbhQXDfMnv1nV5Z4IqQiCA0ErDZY58Zt BN2qccJQ9xBL65VfPMRGZAthnYbyTnWYCimyegAzZRTKfTblYVdwdCcwxSq5aa047Lvz Vywx62ibB/MbxjgHKmQbM4fr0kHK3R4f7qymVwXH4q9QcBRZLPf/Wv3dD7QTUuKf74PL /TBMj5tc7deQbscH6WQtaC8oe+Hv/e+2M3+rypcbgincOPgvA/qgtrjcYvWL6N+3jcjC w3nA== 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; bh=8D3TSepyyZ92NiERBV+pM7P7+jER/TFerYfhPgxRmT8=; b=PlTcc0ScGHIILg1RKcxUbSveVgFhSOVEZch9KPZIEC5cU7xZJmLlPYNgT2K8xQy7wQ 32CUY/4BfQN1DjYFbV0jqrpnww4GEFIL4hyr62M8Z8+9gF+kczWq0hj+KKFIEzYYQ0yZ 8mlB2mY+Iq5NzEmjSrCivw/wy3MrrP99lXNmEFIzSDHtg1OgMUtWB/jwn02B/cA+tlq5 oNOaI/I23is2HrwdsZ3MsnCv2Q2L+DB9aJTtt7rm8uOlFHorFC+dIqLm8SwbVSvbVaC+ 8NxfzCR6tBvx3KAhOhoXYN+Ywl5LIJq5E561FHRmdAaowq+QeNBhX/jjY4XVVPqjmLO+ ZnGQ== X-Gm-Message-State: APt69E3kETz721qxPWocyamsvIU8u5RBiq4ZNe8/mFCfapxeJT7RAZa5 oNaFBUeSOr301c9xGvmCsxuAACiY X-Received: by 2002:a1c:14cc:: with SMTP id 195-v6mr2750428wmu.48.1528415025079; Thu, 07 Jun 2018 16:43:45 -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 r2-v6sm18640545wrq.55.2018.06.07.16.43.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 16:43:44 -0700 (PDT) From: Mark Thompson To: ffmpeg-devel@ffmpeg.org Date: Fri, 8 Jun 2018 00:43:01 +0100 Message-Id: <20180607234331.32139-7-sw@jkqxz.net> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180607234331.32139-1-sw@jkqxz.net> References: <20180607234331.32139-1-sw@jkqxz.net> Subject: [FFmpeg-devel] [PATCH v2 06/36] vaapi_encode_vp8: Move options and common structures into context 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/vaapi_encode_vp8.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c index a2e861a8d1..ab5e0b2dda 100644 --- a/libavcodec/vaapi_encode_vp8.c +++ b/libavcodec/vaapi_encode_vp8.c @@ -32,14 +32,16 @@ typedef struct VAAPIEncodeVP8Context { - int q_index_i; - int q_index_p; -} VAAPIEncodeVP8Context; + VAAPIEncodeContext common; -typedef struct VAAPIEncodeVP8Options { + // User options. int loop_filter_level; int loop_filter_sharpness; -} VAAPIEncodeVP8Options; + + // Derived settings. + int q_index_i; + int q_index_p; +} VAAPIEncodeVP8Context; #define vseq_var(name) vseq->name, name @@ -73,9 +75,8 @@ static int vaapi_encode_vp8_init_sequence_params(AVCodecContext *avctx) static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic) { - VAAPIEncodeContext *ctx = avctx->priv_data; + VAAPIEncodeVP8Context *priv = avctx->priv_data; VAEncPictureParameterBufferVP8 *vpic = pic->codec_picture_params; - VAAPIEncodeVP8Options *opt = ctx->codec_options; int i; vpic->reconstructed_frame = pic->recon_surface; @@ -116,8 +117,8 @@ static int vaapi_encode_vp8_init_picture_params(AVCodecContext *avctx, vpic->pic_flags.bits.version = 0; vpic->pic_flags.bits.loop_filter_type = 0; for (i = 0; i < 4; i++) - vpic->loop_filter_level[i] = opt->loop_filter_level; - vpic->sharpness_level = opt->loop_filter_sharpness; + vpic->loop_filter_level[i] = priv->loop_filter_level; + vpic->sharpness_level = priv->loop_filter_sharpness; vpic->clamp_qindex_low = 0; vpic->clamp_qindex_high = 127; @@ -130,8 +131,7 @@ static int vaapi_encode_vp8_write_quant_table(AVCodecContext *avctx, int index, int *type, char *data, size_t *data_len) { - VAAPIEncodeContext *ctx = avctx->priv_data; - VAAPIEncodeVP8Context *priv = ctx->priv_data; + VAAPIEncodeVP8Context *priv = avctx->priv_data; VAQMatrixBufferVP8 quant; int i, q; @@ -161,8 +161,7 @@ static int vaapi_encode_vp8_write_quant_table(AVCodecContext *avctx, static av_cold int vaapi_encode_vp8_configure(AVCodecContext *avctx) { - VAAPIEncodeContext *ctx = avctx->priv_data; - VAAPIEncodeVP8Context *priv = ctx->priv_data; + VAAPIEncodeVP8Context *priv = avctx->priv_data; priv->q_index_p = av_clip(avctx->global_quality, 0, VP8_MAX_QUANT); if (avctx->i_quant_factor > 0.0) @@ -225,8 +224,7 @@ static av_cold int vaapi_encode_vp8_init(AVCodecContext *avctx) return ff_vaapi_encode_init(avctx); } -#define OFFSET(x) (offsetof(VAAPIEncodeContext, codec_options_data) + \ - offsetof(VAAPIEncodeVP8Options, x)) +#define OFFSET(x) offsetof(VAAPIEncodeVP8Context, x) #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) static const AVOption vaapi_encode_vp8_options[] = { { "loop_filter_level", "Loop filter level", @@ -256,8 +254,7 @@ AVCodec ff_vp8_vaapi_encoder = { .long_name = NULL_IF_CONFIG_SMALL("VP8 (VAAPI)"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_VP8, - .priv_data_size = (sizeof(VAAPIEncodeContext) + - sizeof(VAAPIEncodeVP8Options)), + .priv_data_size = sizeof(VAAPIEncodeVP8Context), .init = &vaapi_encode_vp8_init, .encode2 = &ff_vaapi_encode2, .close = &ff_vaapi_encode_close,