From patchwork Wed Dec 19 21:52:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rene Claus X-Patchwork-Id: 11479 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 73FE844D3F3 for ; Wed, 19 Dec 2018 23:53:37 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9940D68AAEF; Wed, 19 Dec 2018 23:53:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3AF4168A66E for ; Wed, 19 Dec 2018 23:53:31 +0200 (EET) Received: by mail-pg1-f202.google.com with SMTP id i124so15489604pgc.2 for ; Wed, 19 Dec 2018 13:53:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=5Z/nMSSfkNslFuW44r2OlLR2IhsT8Hqd16BHS/bM2fc=; b=Yp+X43mpxSWJ7Yfc+Z91XOvHIv/qLK+64Sf0NM8bo3ZfBtF8JlJpY6TgECsx8X3+WJ y7F7gPZLxOeC5C8u9t8koQw4+pofeSTBRTZ91W7F6Lv5wgNIBLNrwZ6phM96hYFrWsT0 s/0lFRhgUWf/3K3A/o7yUDteOGrMJVsOeOJ/3BFYQ4lUEQRpokYPjxTzW8pR/cotdAAE 8PXu1GGblVHcYC6mRN9w+t9FlLPfN6i01Qh8ly40QOIorkORpdzffHZl59baYkFpeRqj 6PVg3ty/ClssSf2USuur0iQSuRykGdq/3tVxPda91u0jWUCkcg9Of6bpYGGiQNXDdcdH zfUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=5Z/nMSSfkNslFuW44r2OlLR2IhsT8Hqd16BHS/bM2fc=; b=kpzLoQDpmvtFt8zPLRGh48F4oY6Zr3AuMI1YIt8rlHECIcI8tu/5eb/L11LbuiCC17 f6UT09ml87io5rhsBS4oX4lFoEa/r0o6F/nHwR/TRKpM2JjbO6SSEX61PU7/TCakb1k9 QQ3FduTiyYWcZHbB89HCRws8EUDue0CRhf9wCaHgA3f8xLHzh3F2+0KjAwDVEKjaJn3D s+s64bg4tKaVKsu7WwgzU6HeiDmTo9fRh/232MYg/pyI1f7vz8YUfZvkOqlWlxl166Pj f6DEZUJE974Rm/bDWyrJvDbEZRO5SMIhJGDQpDALt9Kd+ZL8RN6hWzbqwi6GtgKYwtHb DQYQ== X-Gm-Message-State: AA+aEWamm1H8gWvHxP1W+VG+71OC7624AEhiPo8o0hNaFElEMQQBekvu oIukZglXR49I/hGoUfo90U74LWtkHbaQDYg7trTyyT0Y1OTNLQuSY2dTuNXlEOz7r51n8XkbbNL jD1imyJTZ5UFfHPWMU7VAMQ4Iw3iUa9s9YJKc0/dipCnvFZhi6BYR+J3SigdV1bE= X-Google-Smtp-Source: AFSGD/VSI5uMcblE3ZKmH1uFbtbh/16iJxVHGH78IGBK9Xy8ySELeNQDp2qB+iPUjAUMe0UUvMjV2F48ugk= X-Received: by 2002:a62:c2ce:: with SMTP id w75mr12332421pfk.48.1545256411728; Wed, 19 Dec 2018 13:53:31 -0800 (PST) Date: Wed, 19 Dec 2018 13:52:44 -0800 In-Reply-To: <20181219182429.247347-1-rclaus@google.com> Message-Id: <20181219215244.167030-1-rclaus@google.com> Mime-Version: 1.0 References: <20181219182429.247347-1-rclaus@google.com> X-Mailer: git-send-email 2.20.1.415.g653613c723-goog From: Rene Claus To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] avcodec/libvpxenc: add VP8/9 sharpness config option 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 Cc: Rene Claus Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This commit adds configuration options to libvpxenc.c that can be used to tune the sharpness parameter for VP8 and VP9. Signed-off-by: Rene Claus --- doc/encoders.texi | 4 ++++ libavcodec/libvpxenc.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index ca3892d682..3dd2989526 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1767,6 +1767,10 @@ Set number of frames to look ahead for frametype and ratecontrol. @item error-resilient Enable error resiliency features. +@item sharpness @var{integer} +Set sharpness. +The valid range is [0, 7]. Default: 0 + @item VP8-specific options @table @option @item ts-parameters diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 39af586790..f9b19a8975 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -76,6 +76,7 @@ typedef struct VPxEncoderContext { struct FrameListData *coded_frame_list; int cpu_used; + int sharpness; /** * VP8 specific flags, see VP8F_* below. */ @@ -130,6 +131,7 @@ static const char *const ctlidstr[] = { [VP8E_SET_TUNING] = "VP8E_SET_TUNING", [VP8E_SET_CQ_LEVEL] = "VP8E_SET_CQ_LEVEL", [VP8E_SET_MAX_INTRA_BITRATE_PCT] = "VP8E_SET_MAX_INTRA_BITRATE_PCT", + [VP8E_SET_SHARPNESS] = "VP8E_SET_SHARPNESS", #if CONFIG_LIBVPX_VP9_ENCODER [VP9E_SET_LOSSLESS] = "VP9E_SET_LOSSLESS", [VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS", @@ -751,6 +753,9 @@ FF_ENABLE_DEPRECATION_WARNINGS return AVERROR(EINVAL); } + if (ctx->sharpness) + codecctl_int(avctx, VP8E_SET_SHARPNESS, ctx->sharpness); + if (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8) { #if FF_API_PRIVATE_OPT FF_DISABLE_DEPRECATION_WARNINGS @@ -1193,6 +1198,7 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt, {"arnr_strength", "altref noise reduction filter strength", offsetof(VPxContext, arnr_strength), AV_OPT_TYPE_INT, {.i64 = 3}, 0, 6, VE}, \ {"arnr_type", "altref noise reduction filter type", offsetof(VPxContext, arnr_type), AV_OPT_TYPE_INT, {.i64 = 3}, 1, 3, VE}, \ {"rc_lookahead", "Number of frames to look ahead for alternate reference frame selection", offsetof(VPxContext, lag_in_frames), AV_OPT_TYPE_INT, {.i64 = 25}, 0, 25, VE}, \ + { "sharpness", "Sharpness", offsetof(VPxContext, sharpness), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 7, VE}, #if CONFIG_LIBVPX_VP8_ENCODER static const AVOption vp8_options[] = {