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 A71054687D for ; Thu, 22 Jun 2023 19:29:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 18D2E68C1E8; Thu, 22 Jun 2023 22:29:43 +0300 (EEST) Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9892C68C156 for ; Thu, 22 Jun 2023 22:29:36 +0300 (EEST) Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6b45803edfcso5559977a34.3 for ; Thu, 22 Jun 2023 12:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687462175; x=1690054175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=15t4f9MLjPJWEooM8eP6wHl1CDYDVpqlPtw39U3pUtU=; b=YESxsRlxrDy+gsVUSjr4q6OWtBFT6WI19SsS7gnJTdJUSSBn7Z0KI16cHXhdPtMRKZ I+dzwTW0BM4ugxAPc97q4lABiTR1R2diU9eF5hAPscEVvA1UTT1Yct4GYVeuc041EGW6 gQu2D8B3mqOsFgl6qp8I3i9de81Ky96wM4P+fYsGGaRhtI6yW9zPru6MDoDC9nnex0Bk sos5i73RcbyWz1qkgi3rMXZ+hNphGlacJNTTcoOvWbC1kCeMOJZooYzxWc4P+X8ANz6b xiQix8kFsj03NEshSWyama39rsNdU3zpgNzxc7WRrmrrBQgzJf4CwPSK38OCGkSLUQPT bS2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687462175; x=1690054175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=15t4f9MLjPJWEooM8eP6wHl1CDYDVpqlPtw39U3pUtU=; b=QeJE1i/yTcVycc7B3iHAnS8eMIBiODqFGGH5W2dBzFuwur46LWcOyDIEC7MYRhBpJK oV0dSI2v1g6gTWOTZ2u8miCm9UtOUFOL1Li7byZE0+o1HPP0l3aUGzNULFHw96PzQwL8 VfVzWqEXwoa5sE9XawN1n0+y4wSvhTOr7G3QOGkp06oR86w7fWo78OcpiGgxlUpAKYsq KGCi4aisbbD26e4whB+oB/be+RRXu5BSqqM8cZ920VkgRM3IPqSrPU6XLK0/LjpbXJ/B jvBgWFQEGzeBB8X2VVwZbIb57U0ddFjkJszOcX1tqyt0wOKS+pX1XyuflHgMS7eZLubh UGHA== X-Gm-Message-State: AC+VfDzRoPmjO0VGv8apXZrp6UH1pUaueGcmmAFtYRvP6ILmCvPWK9zv 9iMkBkwJfV9BB56LypPActpdDMcwRPM= X-Google-Smtp-Source: ACHHUZ4WHoieIb0HiQa1TlgkUPsCzeZrLzWZ9jLsgQXZDWXgb7a9wSEZtfmZ2GdFOTwW6524dBt7Uw== X-Received: by 2002:a9d:7392:0:b0:6b5:5d07:b68b with SMTP id j18-20020a9d7392000000b006b55d07b68bmr10821551otk.28.1687462174655; Thu, 22 Jun 2023 12:29:34 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id w17-20020a9d6391000000b006ac75cff491sm3124631otk.3.2023.06.22.12.29.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 12:29:34 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Jun 2023 16:29:15 -0300 Message-ID: <20230622192918.3638-2-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230622192918.3638-1-jamrial@gmail.com> References: <20230622192918.3638-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/5] avformat/evc: remove unnecessary struct 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 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: And don't use get_ue_golomb_long() for known small values. Signed-off-by: James Almer --- libavformat/evc.c | 67 ++++++++++------------------------------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/libavformat/evc.c b/libavformat/evc.c index f6e53aa6cf..1c72b141bd 100644 --- a/libavformat/evc.c +++ b/libavformat/evc.c @@ -41,35 +41,6 @@ enum { NB_ARRAYS }; -// The sturcture reflects SPS RBSP(raw byte sequence payload) layout -// @see ISO_IEC_23094-1 section 7.3.2.1 -// -// The following descriptors specify the parsing process of each element -// u(n) - unsigned integer using n bits -// ue(v) - unsigned integer 0-th order Exp_Golomb-coded syntax element with the left bit first -typedef struct EVCSPS { - int sps_seq_parameter_set_id; // ue(v) - int profile_idc; // u(8) - int level_idc; // u(8) - int toolset_idc_h; // u(32) - int toolset_idc_l; // u(32) - int chroma_format_idc; // ue(v) - int pic_width_in_luma_samples; // ue(v) - int pic_height_in_luma_samples; // ue(v) - int bit_depth_luma_minus8; // ue(v) - int bit_depth_chroma_minus8; // ue(v) - - // @note - // Currently the structure does not reflect the entire SPS RBSP layout. - // It contains only the fields that are necessary to read from the NAL unit all the values - // necessary for the correct initialization of EVCDecoderConfigurationRecord - - // @note - // If necessary, add the missing fields to the structure to reflect - // the contents of the entire NAL unit of the SPS type - -} EVCSPS; - // @see ISO/IEC 14496-15:2021 Coding of audio-visual objects - Part 15: section 12.3.3.3 typedef struct EVCNALUnitArray { uint8_t array_completeness; // when equal to 1 indicates that all NAL units of the given type are in the following array @@ -116,7 +87,7 @@ typedef struct NALUList { static int evcc_parse_sps(const uint8_t *bs, int bs_size, EVCDecoderConfigurationRecord *evcc) { GetBitContext gb; - EVCSPS sps; + unsigned sps_seq_parameter_set_id; bs += EVC_NALU_HEADER_SIZE; bs_size -= EVC_NALU_HEADER_SIZE; @@ -124,41 +95,31 @@ static int evcc_parse_sps(const uint8_t *bs, int bs_size, EVCDecoderConfiguratio if (init_get_bits8(&gb, bs, bs_size) < 0) return 0; - sps.sps_seq_parameter_set_id = get_ue_golomb_long(&gb); + sps_seq_parameter_set_id = get_ue_golomb_31(&gb); - if (sps.sps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT) + if (sps_seq_parameter_set_id >= EVC_MAX_SPS_COUNT) return 0; // the Baseline profile is indicated by profile_idc eqal to 0 // the Main profile is indicated by profile_idc eqal to 1 - sps.profile_idc = get_bits(&gb, 8); + evcc->profile_idc = get_bits(&gb, 8); - sps.level_idc = get_bits(&gb, 8); + evcc->level_idc = get_bits(&gb, 8); - sps.toolset_idc_h = get_bits_long(&gb, 32); - sps.toolset_idc_l = get_bits_long(&gb, 32); + evcc->toolset_idc_h = get_bits_long(&gb, 32); + evcc->toolset_idc_l = get_bits_long(&gb, 32); // 0 - monochrome // 1 - 4:2:0 // 2 - 4:2:2 // 3 - 4:4:4 - sps.chroma_format_idc = get_ue_golomb_long(&gb); - - sps.pic_width_in_luma_samples = get_ue_golomb_long(&gb); - sps.pic_height_in_luma_samples = get_ue_golomb_long(&gb); - - sps.bit_depth_luma_minus8 = get_ue_golomb_long(&gb); - sps.bit_depth_chroma_minus8 = get_ue_golomb_long(&gb); - - evcc->profile_idc = sps.profile_idc; - evcc->level_idc = sps.level_idc; - evcc->toolset_idc_h = sps.toolset_idc_h; - evcc->toolset_idc_l = sps.toolset_idc_l; - evcc->chroma_format_idc = sps.chroma_format_idc; - evcc->bit_depth_luma_minus8 = sps.bit_depth_luma_minus8; - evcc->bit_depth_chroma_minus8 = sps.bit_depth_chroma_minus8; - evcc->pic_width_in_luma_samples = sps.pic_width_in_luma_samples; - evcc->pic_height_in_luma_samples = sps.pic_height_in_luma_samples; + evcc->chroma_format_idc = get_ue_golomb_31(&gb); + + evcc->pic_width_in_luma_samples = get_ue_golomb_long(&gb); + evcc->pic_height_in_luma_samples = get_ue_golomb_long(&gb); + + evcc->bit_depth_luma_minus8 = get_ue_golomb_31(&gb); + evcc->bit_depth_chroma_minus8 = get_ue_golomb_31(&gb); return 0; } -- 2.41.0 _______________________________________________ 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".