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 0B0FE4B5F7 for ; Sun, 9 Jun 2024 15:06:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6186F68D4BF; Sun, 9 Jun 2024 18:06:05 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8CDC368D3C6 for ; Sun, 9 Jun 2024 18:05:58 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1717945557; bh=vX7a6x5BL4NoaArWIDYY8zkBStupreo4e9ksqBz90ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLChc+1CM0Y/YmybyMubsoV47atJqPmHqxcw8erm3HzHA4+XgCZr6hXfqX5fKHrD3 N9LfIQ6rv/gAQVb6n39I1TWK5vdFHpC8FnU4mIy5erYIQvuZBgeoa+N4Kcfr1C6xbR I4WFgNyTPg5zdHaeYvp8sEuOwEnrgonaUlbJwDQk= Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id AB5E642385; Sun, 9 Jun 2024 17:05:57 +0200 (CEST) From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jun 2024 17:05:49 +0200 Message-ID: <20240609150553.72865-4-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240609150553.72865-1-ffmpeg@haasn.xyz> References: <20240609150553.72865-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/8] avcodec/dovi_rpudec: simplify vdr handling (cosmetic) 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 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: Niklas Haas Move `vdr` into local scope and point only to the field we actually care about. --- libavcodec/dovi_rpudec.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/libavcodec/dovi_rpudec.c b/libavcodec/dovi_rpudec.c index 3e15453705..753e402dc6 100644 --- a/libavcodec/dovi_rpudec.c +++ b/libavcodec/dovi_rpudec.c @@ -296,7 +296,6 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, { AVDOVIRpuDataHeader *hdr = &s->header; GetBitContext *gb = &(GetBitContext){0}; - DOVIVdr *vdr; int ret; uint8_t rpu_type; @@ -454,9 +453,9 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, prev_vdr_rpu_id); goto fail; } - vdr = s->vdr[prev_vdr_rpu_id]; - s->mapping = &vdr->mapping; + s->mapping = &s->vdr[prev_vdr_rpu_id]->mapping; } else { + AVDOVIDataMapping *mapping; int vdr_rpu_id = get_ue_golomb_31(gb); VALIDATE(vdr_rpu_id, 0, DOVI_MAX_DM_ID); if (!s->vdr[vdr_rpu_id]) { @@ -465,15 +464,13 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, return AVERROR(ENOMEM); } - vdr = s->vdr[vdr_rpu_id]; - s->mapping = &vdr->mapping; - - vdr->mapping.vdr_rpu_id = vdr_rpu_id; - vdr->mapping.mapping_color_space = get_ue_golomb_31(gb); - vdr->mapping.mapping_chroma_format_idc = get_ue_golomb_31(gb); + s->mapping = mapping = &s->vdr[vdr_rpu_id]->mapping; + mapping->vdr_rpu_id = vdr_rpu_id; + mapping->mapping_color_space = get_ue_golomb_31(gb); + mapping->mapping_chroma_format_idc = get_ue_golomb_31(gb); for (int c = 0; c < 3; c++) { - AVDOVIReshapingCurve *curve = &vdr->mapping.curves[c]; + AVDOVIReshapingCurve *curve = &mapping->curves[c]; int num_pivots_minus_2 = get_ue_golomb_31(gb); int pivot = 0; @@ -487,28 +484,28 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, if (use_nlq) { int nlq_pivot = 0; - vdr->mapping.nlq_method_idc = get_bits(gb, 3); + mapping->nlq_method_idc = get_bits(gb, 3); for (int i = 0; i < 2; i++) { nlq_pivot += get_bits(gb, hdr->bl_bit_depth); - vdr->mapping.nlq_pivots[i] = av_clip_uint16(nlq_pivot); + mapping->nlq_pivots[i] = av_clip_uint16(nlq_pivot); } /** * The patent mentions another legal value, NLQ_MU_LAW, but it's * not documented anywhere how to parse or apply that type of NLQ. */ - VALIDATE(vdr->mapping.nlq_method_idc, 0, AV_DOVI_NLQ_LINEAR_DZ); + VALIDATE(mapping->nlq_method_idc, 0, AV_DOVI_NLQ_LINEAR_DZ); } else { - vdr->mapping.nlq_method_idc = AV_DOVI_NLQ_NONE; + mapping->nlq_method_idc = AV_DOVI_NLQ_NONE; } - vdr->mapping.num_x_partitions = get_ue_golomb_long(gb) + 1; - vdr->mapping.num_y_partitions = get_ue_golomb_long(gb) + 1; + mapping->num_x_partitions = get_ue_golomb_long(gb) + 1; + mapping->num_y_partitions = get_ue_golomb_long(gb) + 1; /* End of rpu_data_header(), start of vdr_rpu_data_payload() */ for (int c = 0; c < 3; c++) { - AVDOVIReshapingCurve *curve = &vdr->mapping.curves[c]; + AVDOVIReshapingCurve *curve = &mapping->curves[c]; for (int i = 0; i < curve->num_pivots - 1; i++) { int mapping_idc = get_ue_golomb_31(gb); VALIDATE(mapping_idc, 0, 1); @@ -549,10 +546,10 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size, if (use_nlq) { for (int c = 0; c < 3; c++) { - AVDOVINLQParams *nlq = &vdr->mapping.nlq[c]; + AVDOVINLQParams *nlq = &mapping->nlq[c]; nlq->nlq_offset = get_bits(gb, hdr->el_bit_depth); nlq->vdr_in_max = get_ue_coef(gb, hdr); - switch (vdr->mapping.nlq_method_idc) { + switch (mapping->nlq_method_idc) { case AV_DOVI_NLQ_LINEAR_DZ: nlq->linear_deadzone_slope = get_ue_coef(gb, hdr); nlq->linear_deadzone_threshold = get_ue_coef(gb, hdr); -- 2.45.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".