From patchwork Tue May 21 04:03:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Stejerean X-Patchwork-Id: 49080 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp4990164pzb; Mon, 20 May 2024 21:03:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJ37XiaVCm7NedppGxi9CdZEAeomx97BYnZoEfQjuBhjr8j7JIRxkaM+grlqew/tSSflpYnW8vtWk/nhF4NfvL6y8s8emBNAC8mw== X-Google-Smtp-Source: AGHT+IHBI02xO1x3M18OaYGlxCzziQeaUMImDqoCWYGk/8fP5EaMlF0zX1uSdmXd1DIwk5LnclQm X-Received: by 2002:a17:906:2817:b0:a61:c730:ac57 with SMTP id a640c23a62f3a-a61c730b01fmr245578366b.74.1716264238036; Mon, 20 May 2024 21:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716264238; cv=none; d=google.com; s=arc-20160816; b=nhRoXCcSfOBXAloy+0iLRd9+SFggYqkKOsQEUARpyCBL+yvfzWi18yF6fcxdiu7kdN ShE4HWzjfcopZFZ/LKblfsokNvPlUtQQ1Oya61f3bEShOWhco2Xtxh0t3GUVqLaGJ1t7 CaABSWWVaUvPBfIJHKs33paIxB3w1Zmn5uaaGkSR765GLoisG7KKI0QCFZGYQ/mWUl3P Fa+mDFpzIrIBoKe9v/T5lhcuUvrAJ0Z7zQJaFTljVHViGTgea4fifPl3q7DRvPCr2Zwq NOpiJXngDISZIlRO3ERcuNBe/O3Q91cP3cVXhWDADMc/nqI3TavWk/KliuzO1dLzwbu0 z8tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to:from :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:thread-topic :thread-index:references:mime-version:date:to:delivered-to; bh=m/5L1kZRScBmQoe3jLsu10fpSSXGzEHqYQm79FapEZw=; fh=CBS/D0cB4KwqFBY8d8UQ4TY1w6HZ9TulitLE+VqI2+k=; b=KQ5Pot+1V9HJqqAjHAdf/HsM2ruQYTLm5LE2qovVp41jCRh9eUJ4fvk6CI0uE9e1Vx byjqqVzhCbf4D9KmMzjV0+u0UyBVf3I5Zu96F6L5KEZ6JtkYsXMfMzs2WkfGJBdoRR95 RmalXhUtZ4VXHzRYKCB7c5QZK40L6dLCznfN/UkpjJP1aEAK56DQ+Oqmyipo6cBJMOq6 71A7wUD31zZgNSl+tn82pNCikYltCUCD5s0qNU3BBr9Do9vNIww1qmEvIGXlL36HR7f3 MTmMrn3lToBM4d0kmx3ViDt6KEYVBvLixUZK8A14g3porfG4nIWdy82L0N78HHBov/Z5 E/Cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a5a17c2cc49si1397560866b.1055.2024.05.20.21.03.57; Mon, 20 May 2024 21:03:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2430D68D275; Tue, 21 May 2024 07:03:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a27-16.smtp-out.us-west-2.amazonses.com (a27-16.smtp-out.us-west-2.amazonses.com [54.240.27.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3DA6868CCE0 for ; Tue, 21 May 2024 07:03:46 +0300 (EEST) To: =?utf-8?q?ffmpeg-devel=40ffmpeg=2Eorg?= Date: Tue, 21 May 2024 04:03:43 +0000 Mime-Version: 1.0 References: <20240521040340.82550-1-cosmin@cosmin.at> X-Mailer: Amazon WorkMail Thread-Index: AQHaqzPe+9hdVsiASRWm3kBDhOLrgg== Thread-Topic: [PATCH] avcodec/dovi - disable metadata compression by default X-Original-Mailer: git-send-email 2.42.1 X-Wm-Sent-Timestamp: 1716264222 Message-ID: <0101018f9951c2f9-963c0b4c-3e47-4f45-8da2-3e02a73fb771-000000@us-west-2.amazonses.com> Feedback-ID: ::1.us-west-2.An468LAV0jCjQDrDLvlZjeAthld7qrhZr+vow8irkvU=:AmazonSES X-SES-Outgoing: 2024.05.21-54.240.27.16 Subject: [FFmpeg-devel] [PATCH] avcodec/dovi - disable metadata compression by default 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: , X-Patchwork-Original-From: Cosmin Stejerean via ffmpeg-devel From: Cosmin Stejerean Reply-To: FFmpeg development discussions and patches Cc: =?utf-8?q?Cosmin_Stejerean?= Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: R8kJg9Evi5gn From: Cosmin Stejerean not all clients support metadata compression, make this an option and off by default until we can verify output. vdr_dm_metadata_changed = 0 case fails the DV verifier so force this to true for now until we can determine the correct output format for this case. --- libavcodec/dovi_rpu.h | 5 +++++ libavcodec/dovi_rpuenc.c | 8 ++++++-- libavcodec/libaomenc.c | 1 + libavcodec/libsvtav1.c | 1 + libavcodec/libx265.c | 1 + 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libavcodec/dovi_rpu.h b/libavcodec/dovi_rpu.h index 8ce0c88e9d..fca30804ae 100644 --- a/libavcodec/dovi_rpu.h +++ b/libavcodec/dovi_rpu.h @@ -71,6 +71,11 @@ typedef struct DOVIContext { AVDOVIDmData *ext_blocks; int num_ext_blocks; + /** + * Enable metadata compression in the output. Currently this is experimental. + */ + int enable_compression; + /** * Private fields internal to dovi_rpu.c */ diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c index 3c3e0f84c0..26ed25733a 100644 --- a/libavcodec/dovi_rpuenc.c +++ b/libavcodec/dovi_rpuenc.c @@ -512,8 +512,12 @@ int ff_dovi_rpu_generate(DOVIContext *s, const AVDOVIMetadata *metadata, } } - vdr_dm_metadata_changed = !s->color || memcmp(s->color, color, sizeof(*color)); - use_prev_vdr_rpu = !memcmp(&s->vdr[vdr_rpu_id]->mapping, mapping, sizeof(*mapping)); + // the output when vdr_dm_metadata_changed is 0 fails the DV verifier + // force it to 1 until we can get some samples or documentation on correct syntax + vdr_dm_metadata_changed = 1; // !s->color || memcmp(s->color, color, sizeof(*color)); + + // not all clients support metadata compression + use_prev_vdr_rpu = s->enable_compression && !memcmp(&s->vdr[vdr_rpu_id]->mapping, mapping, sizeof(*mapping)); buffer_size = 12 /* vdr seq info */ + 5 /* CRC32 + terminator */; buffer_size += num_ext_blocks_v1 * 13; diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index dec74ebecd..c6104f5522 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -1489,6 +1489,7 @@ static const AVOption options[] = { { "still-picture", "Encode in single frame mode (typically used for still AVIF images).", OFFSET(still_picture), AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1, VE }, { "dolbyvision", "Enable Dolby Vision RPU coding", OFFSET(dovi.enable), AV_OPT_TYPE_BOOL, {.i64 = FF_DOVI_AUTOMATIC }, -1, 1, VE, .unit = "dovi" }, { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DOVI_AUTOMATIC}, .flags = VE, .unit = "dovi" }, + { "dv_enable_compression", "Enable Dolby Vision metadata compression", OFFSET(dovi.enable_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE }, { "enable-rect-partitions", "Enable rectangular partitions", OFFSET(enable_rect_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, { "enable-1to4-partitions", "Enable 1:4/4:1 partitions", OFFSET(enable_1to4_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, { "enable-ab-partitions", "Enable ab shape partitions", OFFSET(enable_ab_partitions), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c index 2fef8c8971..86bb6686dd 100644 --- a/libavcodec/libsvtav1.c +++ b/libavcodec/libsvtav1.c @@ -733,6 +733,7 @@ static const AVOption options[] = { { "dolbyvision", "Enable Dolby Vision RPU coding", OFFSET(dovi.enable), AV_OPT_TYPE_BOOL, {.i64 = FF_DOVI_AUTOMATIC }, -1, 1, VE, .unit = "dovi" }, { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DOVI_AUTOMATIC}, .flags = VE, .unit = "dovi" }, + { "dv_enable_compression", "Enable Dolby Vision metadata compression", OFFSET(dovi.enable_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE }, {NULL}, }; diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index ac1dbc4f97..2a79a5e6da 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -953,6 +953,7 @@ static const AVOption options[] = { #if X265_BUILD >= 167 { "dolbyvision", "Enable Dolby Vision RPU coding", OFFSET(dovi.enable), AV_OPT_TYPE_BOOL, {.i64 = FF_DOVI_AUTOMATIC }, -1, 1, VE, .unit = "dovi" }, { "auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DOVI_AUTOMATIC}, .flags = VE, .unit = "dovi" }, + { "dv_enable_compression", "Enable Dolby Vision metadata compression", OFFSET(dovi.enable_compression), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, VE }, #endif { NULL } };