From patchwork Tue Aug 27 15:05:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 51196 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c944:0:b0:48e:c0f8:d0de with SMTP id k4csp474409vqt; Tue, 27 Aug 2024 13:00:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWCZl7l4or4kjRhqZsHdmxA/28WixMZoRmjln6v+tE93hP35Ol/HBsImjem+HkhzVft/p3Sjx5QLPTK1RHl7lyg@gmail.com X-Google-Smtp-Source: AGHT+IGIVAaWlb+xkkS3/WSWLm+MsKMGUZbYtPuqBrWbkQJjvXzQmuRy+4e5pLcb7XmZmo4D8p0Q X-Received: by 2002:a05:6512:1394:b0:52f:d17e:46b with SMTP id 2adb3069b0e04-5343888a93dmr11865338e87.54.1724788818493; Tue, 27 Aug 2024 13:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724788818; cv=none; d=google.com; s=arc-20240605; b=Fu+uzCkRDgEAWWYgK7/zShwXhrMg/DvtNX2vciVe2x25nn7pRBwHqWEc0iIl5KkYhY i5z6+/Lj9BqImtpB/MNNxYD9+MNF+gpYQcs9odZsZZR/Ioys1ubK+c1qJG5RQBWmuqdJ f5HuH5P4KFCeqoYg5av1lPXSdSWSv9zFD0/ekg0bEKLSdIJuYG+IU92+elK1u3y/tlhh RXHbS9O/wlhl8e0ZEAr3HqiAhXsspSrSKGFWpY1O4hyEZUyoGYmpolpnJuDqOvL1P283 vvR0DNjSRy12vYEDbcksIoZf57oZNM4/BdqdjmQZLlktZme/y5sV/3pSRLiPd0Eqb5aI /YuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:content-transfer-encoding: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=jz0gemlUtwOFJcV4rU3cX4lvmZe930NKjiruQhLCOeA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=Mg9S0rdy3wO/3s/6worS+Fdqyzj9UPzZsSLVA0r9b5QBvw+BNtaqAi43Jtd6AA3Rby tZ/AcgJBTeMli92DhPX2q7BcZdk9lidu1eqyqqeYn/ORsK4piEtG3O4JSNolLvScU4we XwkxA6Gb9r2P4uTc563zfqElsFAUhh7+RiwrIKiDIM/0kgkFnl4NRWZ7721z+OHpj7Je 3i+aHNd1x/8mtoFBPP/X15+XGVnzUB9qv8o1gVpO10Vr5px8tBhJWJ3jiQYgUs7Kdjwo 8WTXOiDuvv0PIxOeTab1gblw84b/YvYxzy3FZZSTr5aDAn1zILn7xbSufpqkTxZQ3v1Y 3xHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=neuET0tV; 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 2adb3069b0e04-5334ea9c2a7si4354382e87.604.2024.08.27.13.00.18; Tue, 27 Aug 2024 13:00:18 -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=@khirnov.net header.s=mail header.b=neuET0tV; 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 CA48168DE3D; Tue, 27 Aug 2024 18:43:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E705768DDA1 for ; Tue, 27 Aug 2024 18:42:58 +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=neuET0tV; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id C95BC4DFE for ; Tue, 27 Aug 2024 17:42:58 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id zbD86EYsba4Q for ; Tue, 27 Aug 2024 17:42:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1724773369; bh=b/4EY4xRdun/13lFL6vclSO0ngbVs0QDH+bjMpTjhHU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=neuET0tVpmk/SE8/auQDM/qtKmylQTCMwYNcRP787zQKlEgrMr5ihIRVUEwVejO+L G9j+1wTO/76zcdC/62LZoGuWKtM4BCq0fbPDdbOF4sJyYVBom9xEjBTpWqw92vt2ne 6IWxsTJosYqLYrFs6JDQ3GGSQbm3XU7xlY9EEoICCHMj8t15aD1sOEZ5Vmn+JU2/IO b6tsk/cCXPuzIt2E4TLY45dO2WcUBggxkg4p0WOMF6uMWLy5r7TAbiq/MvSKNnsanR e923EVsg30lBukzcgqam+2g3GmW3IPiKRcbstlE8SWBEp7y4YNWCI7zEyPUq7CNRZc LGGxnP6FCZh1w== 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 811E64E19 for ; Tue, 27 Aug 2024 17:42:49 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 0E51A3A30A8 for ; Tue, 27 Aug 2024 17:42:43 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 27 Aug 2024 17:05:09 +0200 Message-ID: <20240827154041.13846-31-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240827154041.13846-2-anton@khirnov.net> References: <20240827154041.13846-2-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 29/42] lavc/hevc/ps: reindent 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: NT5OJPCSFJ8E --- libavcodec/hevc/ps.c | 178 +++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c index 0b34dd10a8..5aebd66ba7 100644 --- a/libavcodec/hevc/ps.c +++ b/libavcodec/hevc/ps.c @@ -1182,10 +1182,10 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, } if (!multi_layer_ext) { - sps->temporal_id_nesting = get_bits(gb, 1); + sps->temporal_id_nesting = get_bits(gb, 1); - if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0) - return ret; + if ((ret = parse_ptl(gb, avctx, 1, &sps->ptl, sps->max_sub_layers)) < 0) + return ret; } *sps_id = get_ue_golomb_long(gb); @@ -1216,69 +1216,69 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, sps->pic_conf_win.bottom_offset = rf->conf_win_bottom_offset; } else { - sps->chroma_format_idc = get_ue_golomb_long(gb); - if (sps->chroma_format_idc > 3U) { - av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", sps->chroma_format_idc); - return AVERROR_INVALIDDATA; - } - - if (sps->chroma_format_idc == 3) - sps->separate_colour_plane = get_bits1(gb); - - if (sps->separate_colour_plane) - sps->chroma_format_idc = 0; - - sps->width = get_ue_golomb_long(gb); - sps->height = get_ue_golomb_long(gb); - if ((ret = av_image_check_size(sps->width, - sps->height, 0, avctx)) < 0) - return ret; - - sps->conformance_window = get_bits1(gb); - if (sps->conformance_window) { - int vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; - int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc]; - sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; - sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; - sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult; - sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult; - - if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { - av_log(avctx, AV_LOG_DEBUG, - "discarding sps conformance window, " - "original values are l:%u r:%u t:%u b:%u\n", - sps->pic_conf_win.left_offset, - sps->pic_conf_win.right_offset, - sps->pic_conf_win.top_offset, - sps->pic_conf_win.bottom_offset); - - sps->pic_conf_win.left_offset = - sps->pic_conf_win.right_offset = - sps->pic_conf_win.top_offset = - sps->pic_conf_win.bottom_offset = 0; + sps->chroma_format_idc = get_ue_golomb_long(gb); + if (sps->chroma_format_idc > 3U) { + av_log(avctx, AV_LOG_ERROR, "chroma_format_idc %d is invalid\n", sps->chroma_format_idc); + return AVERROR_INVALIDDATA; } - } - sps->bit_depth = get_ue_golomb_31(gb) + 8; - if (sps->bit_depth > 16) { - av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n", - sps->bit_depth); - return AVERROR_INVALIDDATA; - } - bit_depth_chroma = get_ue_golomb_31(gb) + 8; - if (bit_depth_chroma > 16) { - av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n", - bit_depth_chroma); - return AVERROR_INVALIDDATA; - } - if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) { - av_log(avctx, AV_LOG_ERROR, - "Luma bit depth (%d) is different from chroma bit depth (%d), " - "this is unsupported.\n", - sps->bit_depth, bit_depth_chroma); - return AVERROR_INVALIDDATA; - } - sps->bit_depth_chroma = bit_depth_chroma; + if (sps->chroma_format_idc == 3) + sps->separate_colour_plane = get_bits1(gb); + + if (sps->separate_colour_plane) + sps->chroma_format_idc = 0; + + sps->width = get_ue_golomb_long(gb); + sps->height = get_ue_golomb_long(gb); + if ((ret = av_image_check_size(sps->width, + sps->height, 0, avctx)) < 0) + return ret; + + sps->conformance_window = get_bits1(gb); + if (sps->conformance_window) { + int vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; + int horiz_mult = hevc_sub_width_c[sps->chroma_format_idc]; + sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; + sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; + sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult; + sps->pic_conf_win.bottom_offset = get_ue_golomb_long(gb) * vert_mult; + + if (avctx->flags2 & AV_CODEC_FLAG2_IGNORE_CROP) { + av_log(avctx, AV_LOG_DEBUG, + "discarding sps conformance window, " + "original values are l:%u r:%u t:%u b:%u\n", + sps->pic_conf_win.left_offset, + sps->pic_conf_win.right_offset, + sps->pic_conf_win.top_offset, + sps->pic_conf_win.bottom_offset); + + sps->pic_conf_win.left_offset = + sps->pic_conf_win.right_offset = + sps->pic_conf_win.top_offset = + sps->pic_conf_win.bottom_offset = 0; + } + } + + sps->bit_depth = get_ue_golomb_31(gb) + 8; + if (sps->bit_depth > 16) { + av_log(avctx, AV_LOG_ERROR, "Luma bit depth (%d) is out of range\n", + sps->bit_depth); + return AVERROR_INVALIDDATA; + } + bit_depth_chroma = get_ue_golomb_31(gb) + 8; + if (bit_depth_chroma > 16) { + av_log(avctx, AV_LOG_ERROR, "Chroma bit depth (%d) is out of range\n", + bit_depth_chroma); + return AVERROR_INVALIDDATA; + } + if (sps->chroma_format_idc && bit_depth_chroma != sps->bit_depth) { + av_log(avctx, AV_LOG_ERROR, + "Luma bit depth (%d) is different from chroma bit depth (%d), " + "this is unsupported.\n", + sps->bit_depth, bit_depth_chroma); + return AVERROR_INVALIDDATA; + } + sps->bit_depth_chroma = bit_depth_chroma; } sps->output_window = sps->pic_conf_win; @@ -1295,37 +1295,37 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, } if (!multi_layer_ext) { - int start; + int start; - sps->sublayer_ordering_info = get_bits1(gb); - start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1; - for (i = start; i < sps->max_sub_layers; i++) { - sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1; - sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb); - sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1; - if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) { - av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n", - sps->temporal_layer[i].max_dec_pic_buffering - 1U); - return AVERROR_INVALIDDATA; - } - if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) { - av_log(avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n", - sps->temporal_layer[i].num_reorder_pics); - if (avctx->err_recognition & AV_EF_EXPLODE || - sps->temporal_layer[i].num_reorder_pics > HEVC_MAX_DPB_SIZE - 1) { + sps->sublayer_ordering_info = get_bits1(gb); + start = sps->sublayer_ordering_info ? 0 : sps->max_sub_layers - 1; + for (i = start; i < sps->max_sub_layers; i++) { + sps->temporal_layer[i].max_dec_pic_buffering = get_ue_golomb_long(gb) + 1; + sps->temporal_layer[i].num_reorder_pics = get_ue_golomb_long(gb); + sps->temporal_layer[i].max_latency_increase = get_ue_golomb_long(gb) - 1; + if (sps->temporal_layer[i].max_dec_pic_buffering > (unsigned)HEVC_MAX_DPB_SIZE) { + av_log(avctx, AV_LOG_ERROR, "sps_max_dec_pic_buffering_minus1 out of range: %d\n", + sps->temporal_layer[i].max_dec_pic_buffering - 1U); return AVERROR_INVALIDDATA; } - sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1; + if (sps->temporal_layer[i].num_reorder_pics > sps->temporal_layer[i].max_dec_pic_buffering - 1) { + av_log(avctx, AV_LOG_WARNING, "sps_max_num_reorder_pics out of range: %d\n", + sps->temporal_layer[i].num_reorder_pics); + if (avctx->err_recognition & AV_EF_EXPLODE || + sps->temporal_layer[i].num_reorder_pics > HEVC_MAX_DPB_SIZE - 1) { + return AVERROR_INVALIDDATA; + } + sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[i].num_reorder_pics + 1; + } } - } - if (!sps->sublayer_ordering_info) { - for (i = 0; i < start; i++) { - sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering; - sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics; - sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase; + if (!sps->sublayer_ordering_info) { + for (i = 0; i < start; i++) { + sps->temporal_layer[i].max_dec_pic_buffering = sps->temporal_layer[start].max_dec_pic_buffering; + sps->temporal_layer[i].num_reorder_pics = sps->temporal_layer[start].num_reorder_pics; + sps->temporal_layer[i].max_latency_increase = sps->temporal_layer[start].max_latency_increase; + } } - } } else { for (int i = 0; i < sps->max_sub_layers; i++) { sps->temporal_layer[i].max_dec_pic_buffering = sps->vps->dpb_size.max_dec_pic_buffering;