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 2D0F74B4BE for ; Fri, 7 Jun 2024 13:09:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B67B968D85B; Fri, 7 Jun 2024 16:04:31 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D557E68D7E1 for ; Fri, 7 Jun 2024 16:03:49 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Ok2Rm14F; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 505A74DDE for ; Fri, 7 Jun 2024 15:03:45 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id vceRzWjt3h5k for ; Fri, 7 Jun 2024 15:03:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765421; bh=3iJwahKuJ4U+DVLTVw2DWcMdGbXRLjvyNC1oOBj8fTg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ok2Rm14Fkc07TrUjKo5B/dRppd1X/E4w/vRK+OIR38ohW2nGJfh2R0Dn4uCZn5CeH fy4Ll4Y1yoT/z4XJ4s5cAH7c5A/38n1mJGQxeorXVfGD0NsmRjdCIrhhjpBT2DABNP Pkd+xzG3KFDcwGCiG32+pHOsBVz++bnp0muuwI3UvAXVvGryUOnPYf1ha0H9dkOznp whUPK5JGBYVxCQ1EJhp4YVu8i0jv1RrJccp/jwi4t3O5OZ90PJ8Ij4RTTeBYGs8QYA yJggXX9Yc3EzJw9a7BQY1pYn1ARPOizYIGJ8wbvEIL/bzeCR0nPe1/HOc9dK2E7OSX TfsgSuqNP6r3g== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 70E4E4DAA for ; Fri, 7 Jun 2024 15:03:41 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 8A5D93A0732 for ; Fri, 07 Jun 2024 15:03:34 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jun 2024 15:01:02 +0200 Message-ID: <20240607130135.9088-6-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> References: <20240607130135.9088-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 06/39] lavc/hevc/parser: stop using HEVCParamSets.[psv]ps 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: The parser does not need to preserve these between frames. --- libavcodec/hevc/parser.c | 55 ++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c index 49f7bccdfa..f4e6e3c36d 100644 --- a/libavcodec/hevc/parser.c +++ b/libavcodec/hevc/parser.c @@ -58,6 +58,8 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, HEVCParamSets *ps = &ctx->ps; HEVCSEI *sei = &ctx->sei; GetBitContext *gb = &nal->gb; + const HEVCPPS *pps; + const HEVCSPS *sps; const HEVCWindow *ow; int i, num = 0, den = 0; @@ -78,28 +80,25 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, av_log(avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id); return AVERROR_INVALIDDATA; } - ps->pps = ps->pps_list[pps_id]; + pps = ps->pps_list[pps_id]; + sps = pps->sps; - if (ps->sps != ps->pps->sps) { - ps->sps = ps->pps->sps; - ps->vps = ps->sps->vps; - } - ow = &ps->sps->output_window; + ow = &sps->output_window; - s->coded_width = ps->sps->width; - s->coded_height = ps->sps->height; - s->width = ps->sps->width - ow->left_offset - ow->right_offset; - s->height = ps->sps->height - ow->top_offset - ow->bottom_offset; - s->format = ps->sps->pix_fmt; - avctx->profile = ps->sps->ptl.general_ptl.profile_idc; - avctx->level = ps->sps->ptl.general_ptl.level_idc; + s->coded_width = sps->width; + s->coded_height = sps->height; + s->width = sps->width - ow->left_offset - ow->right_offset; + s->height = sps->height - ow->top_offset - ow->bottom_offset; + s->format = sps->pix_fmt; + avctx->profile = sps->ptl.general_ptl.profile_idc; + avctx->level = sps->ptl.general_ptl.level_idc; - if (ps->vps->vps_timing_info_present_flag) { - num = ps->vps->vps_num_units_in_tick; - den = ps->vps->vps_time_scale; - } else if (ps->sps->vui.vui_timing_info_present_flag) { - num = ps->sps->vui.vui_num_units_in_tick; - den = ps->sps->vui.vui_time_scale; + if (sps->vps->vps_timing_info_present_flag) { + num = sps->vps->vps_num_units_in_tick; + den = sps->vps->vps_time_scale; + } else if (sps->vui.vui_timing_info_present_flag) { + num = sps->vui.vui_num_units_in_tick; + den = sps->vui.vui_time_scale; } if (num != 0 && den != 0) @@ -110,15 +109,15 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, unsigned int slice_segment_addr; int slice_address_length; - if (ps->pps->dependent_slice_segments_enabled_flag) + if (pps->dependent_slice_segments_enabled_flag) dependent_slice_segment_flag = get_bits1(gb); else dependent_slice_segment_flag = 0; - slice_address_length = av_ceil_log2_c(ps->sps->ctb_width * - ps->sps->ctb_height); + slice_address_length = av_ceil_log2_c(sps->ctb_width * + sps->ctb_height); slice_segment_addr = get_bitsz(gb, slice_address_length); - if (slice_segment_addr >= ps->sps->ctb_width * ps->sps->ctb_height) { + if (slice_segment_addr >= sps->ctb_width * sps->ctb_height) { av_log(avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", slice_segment_addr); return AVERROR_INVALIDDATA; @@ -129,7 +128,7 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, if (dependent_slice_segment_flag) return 0; /* break; */ - for (i = 0; i < ps->pps->num_extra_slice_header_bits; i++) + for (i = 0; i < pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); // slice_reserved_undetermined_flag[] slice_type = get_ue_golomb_31(gb); @@ -143,16 +142,16 @@ static int hevc_parse_slice_header(AVCodecParserContext *s, H2645NAL *nal, slice_type == HEVC_SLICE_P ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; - if (ps->pps->output_flag_present_flag) + if (pps->output_flag_present_flag) skip_bits1(gb); // pic_output_flag - if (ps->sps->separate_colour_plane) + if (sps->separate_colour_plane) skip_bits(gb, 2); // colour_plane_id if (!IS_IDR_NAL(nal)) { - int pic_order_cnt_lsb = get_bits(gb, ps->sps->log2_max_poc_lsb); + int pic_order_cnt_lsb = get_bits(gb, sps->log2_max_poc_lsb); s->output_picture_number = ctx->poc = - ff_hevc_compute_poc(ps->sps, ctx->pocTid0, pic_order_cnt_lsb, nal->type); + ff_hevc_compute_poc(sps, ctx->pocTid0, pic_order_cnt_lsb, nal->type); } else s->output_picture_number = ctx->poc = 0; -- 2.43.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".