From patchwork Tue May 21 01:17:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Stejerean X-Patchwork-Id: 49070 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:3a48:b0:1af:fc2d:ff5a with SMTP id zu8csp4934186pzb; Mon, 20 May 2024 18:17:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWcIWHaUE5Yx1F4TNXgaaDMflYwAoNH20mlNdY+9IUuMqb5uQqzUeZ6Y+a9v0S4+OGH8gecwnT0md7QG4Xkz5L56g1UqjYup/nVrg== X-Google-Smtp-Source: AGHT+IEYLKE5beqBgfHTLTfXC7EXHjCINxdhHvpqPthGHErxM3AqcXI2u79XfBZUxVkWaX07qWe2 X-Received: by 2002:a50:c358:0:b0:574:ebfb:6d97 with SMTP id 4fb4d7f45d1cf-574ebfb6e33mr12238318a12.36.1716254267674; Mon, 20 May 2024 18:17:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1716254267; cv=none; d=google.com; s=arc-20160816; b=JkJHKeYIbL6WdZdGWgX00GyhO+atf4eoIy8PI53v6EYee8pcUscRrfa50EU4nX3yXA kzUZooJBzX9N6Nb0ve/nwAKCBJdavX3RoOOSv38L2RfDqevj2NCvjZdELH50lRrywJZG RGYB1vYqU9FpJZO0ieOxqaTd75hQOxOllcKdZZpVfIudgFwYRrumQN7v5y5GJtaqVjJU 0tV+tgK8ByZndxkHGaNwH2E5ZrMk+KD2pmpTRHOMWc8bmqn1rS1mjDP8pmvjc7NtKwRs dATjMtljwslWFXGFfYSqPHbJO2Wb/BjGbVS4Bz9N+5GzqK2KHl5F1RwG+rxyBJ5zvpVQ jcvw== 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=B9aDDfvXWPlNqdw9AV4sn/+0xRq1pNQqlRXyLWPVVDo=; fh=CBS/D0cB4KwqFBY8d8UQ4TY1w6HZ9TulitLE+VqI2+k=; b=KMy/jpFqvp8JBY/tHIqqjXmpO2pHvOcfK1rubeW5O9mXB7h1mre7ec45XHSjSxrs+Y 3OJgYq2xUdcfaS+g44YHEodjXiX0nE3z479kIrSwrserBBL9t3HPsoFoi9o58TIdCClB GB0gSqfmcmAyk9SccoqXvE8JPieyWSC7haTj6FoPznhLEWyGTdfPrAWQDYK+3kGGnK9f N7HJ6qapPoTx5okwwBJq2Rszri0gHjCZ4m5J7PAKZnDKbsvgk7ZPvx7fUynjccI+dpUE COn00UvCysyISdUCptt5C3MeZbEhlQALwLjcSVN0pYhVaDBLtP5Zfuqyn/b9OgAjMLeb IOvg==; 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 4fb4d7f45d1cf-5733c378600si14261747a12.638.2024.05.20.18.17.46; Mon, 20 May 2024 18:17:47 -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 E8DAA68D275; Tue, 21 May 2024 04:17:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from a27-234.smtp-out.us-west-2.amazonses.com (unknown [54.240.27.234]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id ECC4B68D1BE for ; Tue, 21 May 2024 04:17:35 +0300 (EEST) To: =?utf-8?q?ffmpeg-devel=40ffmpeg=2Eorg?= Date: Tue, 21 May 2024 01:17:32 +0000 Mime-Version: 1.0 References: <20240521011728.29347-1-cosmin@cosmin.at> X-Mailer: Amazon WorkMail Thread-Index: AQHaqxymBDX4oF7lSnaZQt5sN2k4MA== Thread-Topic: [PATCH] avcodec/dovi_rpudec - correctly read el_bit_depth_minus8 when ext_mapping_idc is non-zero X-Original-Mailer: git-send-email 2.42.1 X-Wm-Sent-Timestamp: 1716254251 Message-ID: <0101018f98b99e17-5074658e-5904-4d46-8d6f-4a7f3630bdd4-000000@us-west-2.amazonses.com> Feedback-ID: ::1.us-west-2.An468LAV0jCjQDrDLvlZjeAthld7qrhZr+vow8irkvU=:AmazonSES X-SES-Outgoing: 2024.05.21-54.240.27.234 Subject: [FFmpeg-devel] [PATCH] avcodec/dovi_rpudec - correctly read el_bit_depth_minus8 when ext_mapping_idc is non-zero 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: souvbaUUtNw5 From: Cosmin Stejerean It looks like the el_bitdepth_minus8 value in the header can also encode ext_mapping_idc in the upper 8 bits. Samples having a non-zero ext_mapping_idc fail validation currently because the value returned is out of range. This bypasses this by currently ignoring the ext_mapping_idc and using only the lower 8 bits for el_bitdepth_minus8. --- libavcodec/dovi_rpudec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 7c7eda9d09..1b11ad3640 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -411,7 +411,9 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, if ((hdr->rpu_format & 0x700) == 0) { int bl_bit_depth_minus8 = get_ue_golomb_31(gb); - int el_bit_depth_minus8 = get_ue_golomb_31(gb); + // this can encode a two byte value, with higher byte being ext_mapping_idc + // use only the lower byte for el_bit_depth_minus8 + uint8_t el_bit_depth_minus8 = get_ue_golomb_long(gb) & 0xFF; int vdr_bit_depth_minus8 = get_ue_golomb_31(gb); VALIDATE(bl_bit_depth_minus8, 0, 8); VALIDATE(el_bit_depth_minus8, 0, 8);