From patchwork Tue Jul 16 11:23:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50558 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:40f5:b0:482:c625:d099 with SMTP id lb53csp205529vqb; Tue, 16 Jul 2024 04:24:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXDfT/ABEbGdLUWXnmlK3MMSPe3gC4T/hdorKHPprVkHSgV06CD0eobwH0S+9el1OwMHxvG8e/3nomWk73kz59Q6A6SHj/fD5O/Ng== X-Google-Smtp-Source: AGHT+IEhXjlQCo3Pzw2D2sNp9CpJmBm8snXr/AkJyKa5jwoMGH576rE27MRkDsV6f+yjS1sQr2MN X-Received: by 2002:a05:6512:3408:b0:52c:939a:d709 with SMTP id 2adb3069b0e04-52edf74aa87mr558627e87.0.1721129066892; Tue, 16 Jul 2024 04:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721129066; cv=none; d=google.com; s=arc-20160816; b=J7/UiJ8bbgvpyocZmautGmppiLPUCa0+Pj0JxlzHuSRudLwmUc6g7W9/cllrpTEP/1 SqLwaONro1xX9fN4nMH/FT3fBp7m+to5MZ7hQBp4ICKmQiMqUJUKi/utm5G9Ma+adVO/ ue2SbdKErHvreM8Su751SFOjx6wuFoIpO0mI4KuV/EPluXI6GnHMoAEB4zFG5+Uc6KXW i9YsDHHFMzRIMvFjyBhs3fZ3n/cNYf6ZDLlA3oQFQonXW4JleyvFQZuzDduiHx370Zhp 5/Gr14apF4byHU0YJ4BJ0emVrjrGAxCJnhNCC/otrDpMiq4zo5UW+Cdh3ZLThiQ0c8Qh ySgg== 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 :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=YMTzNY3023L1gRnCGnWdx9rJ1gV8Cjmq/1UHllFGKE4=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=QT5DZygcC+P/ss28h5WSgTUZUGq4Yj3ngm9eCGar35nO42X6q7cKm3inj+K0AC5PYn CiYddnMZ1TmzVhYh5WQbIc0wcjoSNGrBFCyUMheP9fYUfbSDMqxXA2rz5qKMBvuu7VCX 1KYBOp3/BT92hnVLCiwcaxdQvGp7xrHpkDsMFOTyisM9PQLf5Dd7Ye0Eb5QKwaSI+fYz lPW31PCI9w4KPrwW9TqUoRi+U9DBazQ4YdjTzjzMP1ol8DNu0vWUk/I70u7q5OXMbl3A xCDxgdReTv7T/aICFly3H8m7GNkawUV+NKtTswUbk6oyd2ltRMeSbyDNki1K0daonV5q HhcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=Nw4036OP; 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 2adb3069b0e04-52ed2582286si2030640e87.617.2024.07.16.04.24.26; Tue, 16 Jul 2024 04:24:26 -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=@haasn.xyz header.s=mail header.b=Nw4036OP; 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 54A4568D9DC; Tue, 16 Jul 2024 14:23:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A58E968D8F5 for ; Tue, 16 Jul 2024 14:23:47 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1721129026; bh=4L+kS2PE4yNx67/nGhtpx6S/yoHUXDP6CWFesTiH9co=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nw4036OP9C3jDzJENUuF+KGcDJPTGHO5e/12t0gg4ya3NlgJxz43OhR2it4C5C2Y9 QG1f1moyP8FJk1kx/+WXKct+9VeGqURGbBFZDmdPMrsN7i/bXHKI+ym/J8kiqA6MYy jcNoFKc0MnZEvA1Y3ExfyNjA/BZyeFTS9o3IgKhc= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 86A3140455; Tue, 16 Jul 2024 13:23:46 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Jul 2024 13:23:14 +0200 Message-ID: <20240716112317.35745-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240716112317.35745-1-ffmpeg@haasn.xyz> References: <20240716112317.35745-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avformat/dovi_isom: implement dv_md_compression 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: , Reply-To: FFmpeg development discussions and patches Cc: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bQf3p+JKUuFW From: Niklas Haas --- libavformat/dovi_isom.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/libavformat/dovi_isom.c b/libavformat/dovi_isom.c index d49aa5a75f..269374cff9 100644 --- a/libavformat/dovi_isom.c +++ b/libavformat/dovi_isom.c @@ -57,11 +57,14 @@ int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st, // Has enough remaining data if (size >= 5) { - dovi->dv_bl_signal_compatibility_id = ((*buf_ptr++) >> 4) & 0x0f; // 4 bits + uint8_t buf = *buf_ptr++; + dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 bits + dovi->dv_md_compression = (buf >> 2) & 0x03; // 2 bits } else { // 0 stands for None // Dolby Vision V1.2.93 profiles and levels dovi->dv_bl_signal_compatibility_id = 0; + dovi->dv_md_compression = AV_DOVI_COMPRESSION_NONE; } if (!av_packet_side_data_add(&st->codecpar->coded_side_data, &st->codecpar->nb_coded_side_data, @@ -71,13 +74,14 @@ int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st, } av_log(logctx, AV_LOG_TRACE, "DOVI in dvcC/dvvC/dvwC box, version: %d.%d, profile: %d, level: %d, " - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", + "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d, compression: %d\n", dovi->dv_version_major, dovi->dv_version_minor, dovi->dv_profile, dovi->dv_level, dovi->rpu_present_flag, dovi->el_present_flag, dovi->bl_present_flag, - dovi->dv_bl_signal_compatibility_id); + dovi->dv_bl_signal_compatibility_id, + dovi->dv_md_compression); return 0; } @@ -97,8 +101,9 @@ void ff_isom_put_dvcc_dvvc(void *logctx, uint8_t out[ISOM_DVCC_DVVC_SIZE], put_bits(&pb, 1, !!dovi->el_present_flag); put_bits(&pb, 1, !!dovi->bl_present_flag); put_bits(&pb, 4, dovi->dv_bl_signal_compatibility_id & 0x0f); + put_bits(&pb, 2, dovi->dv_md_compression & 0x03); - put_bits(&pb, 28, 0); /* reserved */ + put_bits(&pb, 26, 0); /* reserved */ put_bits32(&pb, 0); /* reserved */ put_bits32(&pb, 0); /* reserved */ put_bits32(&pb, 0); /* reserved */ @@ -108,12 +113,14 @@ void ff_isom_put_dvcc_dvvc(void *logctx, uint8_t out[ISOM_DVCC_DVVC_SIZE], av_log(logctx, AV_LOG_DEBUG, "DOVI in %s box, version: %d.%d, profile: %d, level: %d, " - "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d\n", + "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: %d, " + "compression: %d\n", dovi->dv_profile > 10 ? "dvwC" : (dovi->dv_profile > 7 ? "dvvC" : "dvcC"), dovi->dv_version_major, dovi->dv_version_minor, dovi->dv_profile, dovi->dv_level, dovi->rpu_present_flag, dovi->el_present_flag, dovi->bl_present_flag, - dovi->dv_bl_signal_compatibility_id); + dovi->dv_bl_signal_compatibility_id, + dovi->dv_md_compression); }