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 DBE9A46564 for ; Tue, 20 Jun 2023 23:36:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DA0E968C10E; Wed, 21 Jun 2023 02:36:15 +0300 (EEST) Received: from us-smtp-delivery-44.mimecast.com (unknown [207.211.30.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D3A2C68B6C6 for ; Wed, 21 Jun 2023 02:36:09 +0300 (EEST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-Atkg9h9DOpKjy0knCy2yfg-1; Tue, 20 Jun 2023 19:36:06 -0400 X-MC-Unique: Atkg9h9DOpKjy0knCy2yfg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5E34805BFB for ; Tue, 20 Jun 2023 23:36:05 +0000 (UTC) Received: from nomad.redhat.com (vpn2-54-59.bne.redhat.com [10.64.54.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6520492C13; Tue, 20 Jun 2023 23:36:04 +0000 (UTC) From: airlied@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Jun 2023 09:36:01 +1000 Message-Id: <20230620233601.1876939-1-airlied@gmail.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: gmail.com Subject: [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 Cc: Dave Airlie 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: 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); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, -- 2.41.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".