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 3E3B44AD52 for ; Tue, 21 May 2024 04:03:56 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E041168D274; Tue, 21 May 2024 07:03:53 +0300 (EEST) 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: , From: Cosmin Stejerean via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: =?UTF-8?Q?Cosmin_Stejerean?= 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: 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 } }; -- 2.42.1 _______________________________________________ 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".