From patchwork Thu Jul 18 10:54:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 50623 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2011:b0:482:c625:d099 with SMTP id fe17csp294829vqb; Thu, 18 Jul 2024 03:55:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6zK8faHwiOrU+mqQZWc8yzET8IN3vtCE35kTNbcs5Usq7mWxqNAKNu/nTaWoQ4CU9axt91F00OaBh9o5J/J1vBcIQ7RJfNmkJlg== X-Google-Smtp-Source: AGHT+IFb1g3Xu8wz7/6UGIdYu/9dWARUkp9QkvmcCkdQOwJsyWz/2dg13V8EO0j1cR6PYk4mLdD7 X-Received: by 2002:a17:906:2849:b0:a72:685b:7c98 with SMTP id a640c23a62f3a-a7a0119e3efmr333711166b.37.1721300122939; Thu, 18 Jul 2024 03:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721300122; cv=none; d=google.com; s=arc-20160816; b=vYL81fS+6wolKDstTxPoycGbPM9JPOax+iJ7WX1NobKsgH/rOS2L3GweIVKwfJpRd3 YqHRsOtUWq3DHRndaSTKSxKzPVhOCUdw01V/wximM2v19lncTy5Z3BtzfflMiH6vDu93 xq2lpbgrE/pH/R6iuSpYpYWQ90uJGdwPx5yIxwdua4xWjvC+TPahvQvXV7VhOlGADo7a jFfW9q2XGTJa9Iy/V8pAR6SiGr5Rkw2HUVNpeNefgTXC/WShHjIQoarZFTv2rAiVOWHd xWfl8iKo0d1KRYU9fiODX48zrzP3Q4P+huNzBKmjn7fGZ8kgIztxp3DnY+y1XmhFN51V HWZQ== 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=WZDRIdqOCliQGAxBFkEETtaRNBip20xqyxdAUlG9QpjbMJvvngIYzR7TK+fk6mHipM +y5IcWEkcRywC0V/6DztXWj944z8FoebQnthbelpBEwIY5HeHvxRYLQeBMCJs9xBPGXl fJx4uYU+0LX5so0GJKj9s5bT168O1AhULs4v1IG2gprCVFt5csN264phl5bDv0oafBAw BZSEpaXKPjp7ocUkPe2bpUw0I39ROUDxRq1fnaOls7V6Q4ZcDOBtUriLnpHlv3/czsWH GDaIIOvhlBX1VzIae6aaPMdg0TcGi7Qwe5l7Yn0hZUwDTOJZ7CRC6xQosZtjJ0oEscIh 8/wQ==; 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=P9xoTDQF; 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-a79bc58b173si624429666b.181.2024.07.18.03.55.22; Thu, 18 Jul 2024 03:55:22 -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=P9xoTDQF; 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 AC3EC68DB05; Thu, 18 Jul 2024 13:55:12 +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 BB8A568DA0B for ; Thu, 18 Jul 2024 13:55:05 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1721300105; bh=4L+kS2PE4yNx67/nGhtpx6S/yoHUXDP6CWFesTiH9co=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9xoTDQFJkQO1mImQRDHTEphaEfZMSf0lUevp4ZtYJ+s2WRzVCds4p/rIYdl43I0D lgtiVjH8u3tC7k9CGWk8pTSJdoV6KOurt0HQLZKK3o8W5h3ie5G8kN67Wb/C2T7Tj3 tgMJnq+o/fmCE7XmD638txUaPjtcWFQ1whZEkIM0= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 838AF41818; Thu, 18 Jul 2024 12:55:05 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Jul 2024 12:54:59 +0200 Message-ID: <20240718105502.232604-2-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240718105502.232604-1-ffmpeg@haasn.xyz> References: <20240718105502.232604-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: 53G/b2gCFcrk 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); }