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 B3968465AA for ; Wed, 21 Jun 2023 21:15:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 80FE068C053; Thu, 22 Jun 2023 00:15:44 +0300 (EEST) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A149068A62B for ; Thu, 22 Jun 2023 00:15:37 +0300 (EEST) Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-977e0fbd742so845082966b.2 for ; Wed, 21 Jun 2023 14:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687382136; x=1689974136; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=mi5MpbgOy4SpGMpt1h4C1KqFnufpRCCVrtkl53zS4fU=; b=qaGmxrBVquReoelFVa/pJUo3kRgRsSBsa9la2+UazMI3gEJCa9v76GoYRgfvOq5Kve PTZ2soohydgYyaFLFhr1URsPu8vncwpy/yujifoMXnY4aU6YPBBH6jzm0qnFVIjeNSVe hjnyLRttjLxlKX3gMlaWEWi8iLKP9jniCIN5AUGqYtDaCVjg9a4jEuYniex+twDG/hwN 6Dn8FBR/9ERM+OY5QISa+KzTGV1yP/KkPTxguRu4GcWrId0wKJbq0G+Om7lvbCLMUXTx evyMH0Nq2JWxiCDZ/WSwBVKfJ0CgeaVh6UKig0NeBNwYI84esHBOwynlataQg27m/nVP RXyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687382136; x=1689974136; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mi5MpbgOy4SpGMpt1h4C1KqFnufpRCCVrtkl53zS4fU=; b=MLDqx7NkOIvQrZR9M0RQFQTqCC32iVvUUCS0lnXlNk6403ukWe816JI42lnUrmkwXW Pn7/UcN3ydXEM39jiAzjGmDjw/x7YL4jCFBN5dQpc2zUZui6B4CLp2n8A21ZkGK1fk4B HbirpEHpUoDdPfmHqoxKHD58Huz0QucFwBciwg9fvUHmKoPH1C7LpJYvzEhOSddv/DY7 h8UyF1I4zzBrSsOqCp+fKjPnBVLj1enLPF/5t4As/Yj3/Ha5BE7ePPJrMpRj9Vh/jCTc E7sGnlyRSDU2tVK5RIu0R6kzyM07VGQ+Gn0tH60bfcYJtLgfJqkFJaoC8bpkCBHpQ8Jx a1wg== X-Gm-Message-State: AC+VfDyAEs1eM8EDb4WVvDguVq4ONG2dDviAFcboCEstAyEG0n9bVQT3 CHFzqS2mcSFMYSYrGV6b2aLYWe9FzVaSuQdNLGh3o9+iWw213g== X-Google-Smtp-Source: ACHHUZ4YQCykkooO0/YXuFejAtXlKWm1ZM/w+Z4yfWDQmAxG42pgzrU7lrX/58yIwzJhKdSZ8wBHZPe6XZsr3B1DTGM= X-Received: by 2002:a17:906:eecc:b0:974:62d1:e942 with SMTP id wu12-20020a170906eecc00b0097462d1e942mr14334721ejb.21.1687382135627; Wed, 21 Jun 2023 14:15:35 -0700 (PDT) MIME-Version: 1.0 References: <20230620233601.1876939-1-airlied@gmail.com> <4d9f0d83-db4c-b0ea-cc9a-e3154c402a6e@gmail.com> In-Reply-To: <4d9f0d83-db4c-b0ea-cc9a-e3154c402a6e@gmail.com> From: Dave Airlie Date: Thu, 22 Jun 2023 07:15:23 +1000 Message-ID: To: FFmpeg development discussions and patches 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-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: On Thu, 22 Jun 2023 at 02:36, James Almer wrote: > > 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. It can but my reading of the spec is that it is illegal to go beyond the max in sequence header. 6.8 Frame header OBU semantics 6.8.4 Frame size semantics " It is a requirement of bitstream conformance that frame_width_minus_1 is less than or equal to max_frame_width_minus_1. It is a requirement of bitstream conformance that frame_height_minus_1 is less than or equal to max_frame_height_minus_1. " Dave. _______________________________________________ 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".