From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 88BA946ADA for ; Mon, 2 Oct 2023 17:21:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB5EB68CB8E; Mon, 2 Oct 2023 20:21:00 +0300 (EEST) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E97C668CA6D for ; Mon, 2 Oct 2023 20:20:53 +0300 (EEST) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-65afac36b2cso18816d6.3 for ; Mon, 02 Oct 2023 10:20:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696267252; x=1696872052; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=eUMtA651z1s1Z81/uU2Um6F0kxW56pprVkRkGpZI8aI=; b=v7RN2tqweIkGbYq6eF1+nwHsumhdMVMTG8scLxVgnUCzEMYa1xqkYM4EejUNK8Fqr8 sL8U5+nLQiT+5m76gCDkBucWpEn4oPqV4IPxvPuckZHpjzyPwY2ncSsSOZpnZncimRsO g3M5C4V4PSqe8vSIR70zMDgvyqLERiomHPSi7PWHlUdSfNLMHtvmRgLSau8E2OFD6zvs UxSaao5M4AfuDFGAJykW7CJp9EYcui728IGAdEug3HJQfvbEFW2CFPGGKxyaV3ZYBYLT z7dVsVctyCLfnNqZuABMUQHV14DvWjw7C+QNwUBkJcNnYKvpsz/R1Sklf8fg3bJS6w70 mp2w== X-Gm-Message-State: AOJu0YzLZkOYvvW5Ux+kNpBFGbY2ONLAJONTf/UmYmxnzvnutSvAkxmQ WLyVWX72gE8WimPG2DY1X1lOP2SVwmy88j9jwB007g== X-Google-Smtp-Source: AGHT+IGpdAiwrTrKyh2w46fDN+J+TU0YCaf5mPALCyH/o+s8OKRhWXJmt2ulOj2gzhbcWLK1LqRvLg== X-Received: by 2002:a0c:8d89:0:b0:65a:fe8f:14a5 with SMTP id t9-20020a0c8d89000000b0065afe8f14a5mr9285153qvb.52.1696267252335; Mon, 02 Oct 2023 10:20:52 -0700 (PDT) Received: from provost.sidefx.com ([167.100.93.16]) by smtp.gmail.com with ESMTPSA id q26-20020a0c8b1a000000b0064f4258184csm6661079qva.53.2023.10.02.10.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 10:20:51 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org Date: Mon, 2 Oct 2023 13:20:49 -0400 Message-Id: <20231002172049.69615-1-johnmather@sidefx.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] avcodec/libkvazaar: Respect codec context color settings. X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: John Mather via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: John Mather Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: This patch makes the libkvazaar encoder respect color settings that are present on the codec context, including color range, primaries, transfer function and colorspace. --- This addresses the issues raised in v2. * The unspecified conditions have been removed as they were unnecessary. * Added the ability to specify the chroma sample location. The unspecified check is required here as without it, if avctx->chroma_sample_location was AVCHROMA_LOC_UNSPECIFIED, cfg->vui.chroma_loc would receive -1, which is outside of the expected range. libavcodec/libkvazaar.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c index 2ef34dd82e..4855d5649d 100644 --- a/libavcodec/libkvazaar.c +++ b/libavcodec/libkvazaar.c @@ -101,6 +101,13 @@ FF_ENABLE_DEPRECATION_WARNINGS cfg->rc_algorithm = KVZ_LAMBDA; } + cfg->vui.fullrange = avctx->color_range == AVCOL_RANGE_JPEG; + cfg->vui.colorprim = avctx->color_primaries; + cfg->vui.transfer = avctx->color_trc; + cfg->vui.colormatrix = avctx->colorspace; + if (avctx->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED) + cfg->vui.chroma_loc = avctx->chroma_sample_location - 1; + if (ctx->kvz_params) { AVDictionary *dict = NULL; if (!av_dict_parse_string(&dict, ctx->kvz_params, "=", ",", 0)) { -- 2.39.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".