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 793E24573B for ; Wed, 21 Jun 2023 16:34:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C2FD968C049; Wed, 21 Jun 2023 19:34:37 +0300 (EEST) Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A985668ADCE for ; Wed, 21 Jun 2023 19:34:31 +0300 (EEST) Received: by mail-qk1-f181.google.com with SMTP id af79cd13be357-7639c68fea3so64435085a.1 for ; Wed, 21 Jun 2023 09:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687365269; x=1689957269; 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=mkNhQGtPDHz7BUkD9qvI9jehM5+jmA9rIndZ4hpWRx4=; b=r+gZyn2Jn3m7LNg2I3m2yD6eeSJp5Ofpc7hNCuSnY1e0OmLpdmIpLBC8BiE/r6aEqC ZI+WsixF1VFWhDyf9N5v5kZExEulKIekjhdQd16/gfqzyC2TWAZTKxSiRf3rmCam+0vo N0mEu9BKRc4D9YOqv2MIgm4MONilUw3RZVbF8Z92Z4oFJNWJuxxcD7fs+DF0fy9bDd4X 5YjpgwddsxG4FYy+52CbJLPA5zXSmNADTglnou+dY2pPwHEO9nWwBzm3rbmAYhBzroof G0DvVpduclPc0xhtWXzxnQovd6G0Te3UD2svtlTQ7ASAkzZHhXkYMHpoEAQoALXC+/iG HZqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687365269; x=1689957269; 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=mkNhQGtPDHz7BUkD9qvI9jehM5+jmA9rIndZ4hpWRx4=; b=SolBDi6L2SXbDcBnV9NtxlzBJjMscl+FFaLYMLMf+hqgH7rVU3lde28iWjBY9deeRr n2+wBhBwG4YL/PXccdsF1pSHUaawdLyKKlECWCnrNef8WtCzt+fJPl95ZA0C7t1hDGrn NJSOkegLCl4rGAg2Ak1iZ26JV7tVE+bobmrd5QNi7b4ALrPagreru2SAxH2KDiNbjlhZ jVjihSGONxwFyebjULt2ztWdJQGpVHsGiM2AspZ3dEdjEldcDE/GkooGFV6Goxdqa1ZS piU/XawTT4nvEEqPyxj/qk8T5jA1p1x8haTPwoK8HOchLSyAn1qgg/3+9LfC0MBo3E1w VVSA== X-Gm-Message-State: AC+VfDyR9OIQIbJtD/TFd8ibfthi7o+NAffUG1Ka7Vtxs/w6VMoCywFJ WcqgGBRCGLHizf2IoFRXioUdKyyZiio= X-Google-Smtp-Source: ACHHUZ6h/LlsDYkI2wi6TFCsaD8q8+rulYr2n4CZmhLjKx+LDoanTm5LCbM8WedjLQtneEB39XxpIw== X-Received: by 2002:a05:620a:8c04:b0:763:a12a:7cfa with SMTP id qz4-20020a05620a8c0400b00763a12a7cfamr7368054qkn.2.1687365269467; Wed, 21 Jun 2023 09:34:29 -0700 (PDT) Received: from [192.168.1.35] (c-98-224-219-15.hsd1.mi.comcast.net. [98.224.219.15]) by smtp.gmail.com with ESMTPSA id o21-20020a05620a15d500b007593bf6e345sm2376805qkm.113.2023.06.21.09.34.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jun 2023 09:34:29 -0700 (PDT) Message-ID: <98f822e6-0e45-ee40-c651-cdd4df6e8700@gmail.com> Date: Wed, 21 Jun 2023 12:34:28 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Content-Language: en-US-large To: ffmpeg-devel@ffmpeg.org References: <20230620233601.1876939-1-airlied@gmail.com> From: Leo Izen 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/23 19:36, 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, I would add a comment above this function documenting that dim_change may be NULL, in which case it will be ignored. This is not a functional issue, it's just comments = readable = good. Also, nitpick, but this fits on the previous line (77 wide, less than 80). Ignore this if you think a new line is more readable, just keep in mind. > 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; You don't need to initialize this variable to zero here, because you initialized it to zero when you declared it. If you prefer to leave this here, then remove the `= 0;` upon declaration. > + 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); > if (ret < 0) { > av_log(avctx, AV_LOG_ERROR, - Leo Izen (Traneptora) _______________________________________________ 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".