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 CFF6345744 for ; Wed, 21 Jun 2023 16:36:55 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 04E5068C051; Wed, 21 Jun 2023 19:36:53 +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 EB61768B6C6 for ; Wed, 21 Jun 2023 19:36:46 +0300 (EEST) Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-6b468ff042cso3600410a34.2 for ; Wed, 21 Jun 2023 09:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687365405; x=1689957405; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=KIpaevqJWZIsuVrxC0oMJNa7ue/jqkjfpQfMbXrPICI=; b=D7btW47LsJXWQEIGfnvs7OmStH0CawL/OFXFbwSmDZBbmMWlCNlvFnqdjGV0DaOQ8L ZysmUEN2ss0TWGggFBoXFSAIyK2Ojzo7v5q3fCodvWi+rQ1T8DeKC4uJgG3xG4byqFny BYKU2SFxegFVTwIYj62WHedDydSoxYqjdnKJfv1hRiTaIxbVeLnrafEsrCX4EoQDf3dM CACd70TeKSQk27/0uIl8Tqnm6grqMBBmsySCyL5Q3nEjfbMiENezkHpU7DYTH+PfqZxD LI7NGjn8HIDPzLl9UIZMgEizj1TBXJktOudNPXXID+YJuYENrNp4Ay+lF2TMyqdAwTc9 lEqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687365405; x=1689957405; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KIpaevqJWZIsuVrxC0oMJNa7ue/jqkjfpQfMbXrPICI=; b=VJ5KzkhgjmiiQZw30LYlxc+QaxZT93maM7wsdAoiLMq0CU1uVtpddDPSAc5Fe5a5DC 09I8LrB6Fm8ZsvTIcUGRhCeWwLzLoZuH1ruaYdjbui1CM71/mqoIGaQzqYpJMc3JJmot NmI9kO2tKxracv5Esb4x5ovm39yrIo+DoGvg37kCvgyb72yJ3G9rSCj1uyRexhKpCSzt shwVU1X52XubKT0NK0m5ERnXoWhZvi4tIS/Yol38V+nIaSTHYYgvXVF6c9n9UfWXcwaE Ju/uQCzMfToqRr9XI4GIdlAN+/6w+8HLluc6Z/XAP3P2Mk85FgXMBru2JMYOl1IdlLkU ucsA== X-Gm-Message-State: AC+VfDzrDPEINkTHuHFQTbsXCFSu+BmzZsVuJwhOXB02D6DYqKhPRwI1 Qbinjd25ighPAhrCIVgMnxdwmlHU2sM= X-Google-Smtp-Source: ACHHUZ4ahmZPsF43NJQcm2jHxsGFHDNOAD2gsUL8QyUjV2tOkanSMqFCeuRcR2mAQFgggbrwI/2BZg== X-Received: by 2002:a05:6830:1042:b0:6b5:ca4f:74db with SMTP id b2-20020a056830104200b006b5ca4f74dbmr1623921otp.9.1687365405022; Wed, 21 Jun 2023 09:36:45 -0700 (PDT) Received: from [192.168.0.12] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id o16-20020a9d7650000000b006b5cb1511c4sm453394otl.9.2023.06.21.09.36.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jun 2023 09:36:44 -0700 (PDT) Message-ID: <4d9f0d83-db4c-b0ea-cc9a-e3154c402a6e@gmail.com> Date: Wed, 21 Jun 2023 13:36:58 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20230620233601.1876939-1-airlied@gmail.com> From: James Almer In-Reply-To: <20230620233601.1876939-1-airlied@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] av1dec: handle dimension changes via get_format 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 6/20/2023 8:36 PM, airlied@gmail.com wrote: > From: Dave Airlie > > av1-1-b8-03-sizeup.ivf on vulkan causes gpu hangs as none of the > images get resized when dimensions change, this detects the dim > change and calls the get_format to reinit the context. > --- > libavcodec/av1dec.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > index e7f98a6c81..1cec328563 100644 > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -721,6 +721,7 @@ static av_cold int av1_decode_free(AVCodecContext *avctx) > } > > static int set_context_with_sequence(AVCodecContext *avctx, > + int *dim_change, > const AV1RawSequenceHeader *seq) > { > int width = seq->max_frame_width_minus_1 + 1; > @@ -753,6 +754,8 @@ static int set_context_with_sequence(AVCodecContext *avctx, > int ret = ff_set_dimensions(avctx, width, height); > if (ret < 0) > return ret; > + if (dim_change) > + *dim_change = 1; > } > avctx->sample_aspect_ratio = (AVRational) { 1, 1 }; > > @@ -859,7 +862,7 @@ static av_cold int av1_decode_init(AVCodecContext *avctx) > goto end; > } > > - ret = set_context_with_sequence(avctx, seq); > + ret = set_context_with_sequence(avctx, NULL, seq); > if (ret < 0) { > av_log(avctx, AV_LOG_WARNING, "Failed to set decoder context.\n"); > goto end; > @@ -1202,7 +1205,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) > CodedBitstreamUnit *unit = &s->current_obu.units[i]; > AV1RawOBU *obu = unit->content; > const AV1RawOBUHeader *header; > - > + int dim_change = 0; > if (!obu) > continue; > > @@ -1220,7 +1223,8 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) > > s->raw_seq = &obu->obu.sequence_header; > > - ret = set_context_with_sequence(avctx, s->raw_seq); > + dim_change = 0; > + ret = set_context_with_sequence(avctx, &dim_change, s->raw_seq); > if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, "Failed to set context.\n"); > s->raw_seq = NULL; > @@ -1229,7 +1233,7 @@ static int av1_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) > > s->operating_point_idc = s->raw_seq->operating_point_idc[s->operating_point]; > > - if (s->pix_fmt == AV_PIX_FMT_NONE) { > + if (s->pix_fmt == AV_PIX_FMT_NONE || dim_change) { > ret = get_pixel_format(avctx); Dimensions can change between frames without a seq header showing up to change the max_width/height values. get_pixel_format() would need to be called on frame headers instead. > if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, _______________________________________________ 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".