From patchwork Tue Feb 1 13:07:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 34039 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp614093iov; Tue, 1 Feb 2022 05:24:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwn5Obr2EOOKJ/zUgCu4+pURG+ZMl/fX4eCaV+H2P2A3ZVnAnK0alEUAzaPu6Fq+kbM7Z/D X-Received: by 2002:a17:906:1e06:: with SMTP id g6mr20809163ejj.517.1643721892428; Tue, 01 Feb 2022 05:24:52 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n3si9610996edd.566.2022.02.01.05.24.51; Tue, 01 Feb 2022 05:24:52 -0800 (PST) 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=@outlook.com header.s=selector1 header.b=T9NluCnZ; arc=fail (body hash mismatch); 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B558468B4B5; Tue, 1 Feb 2022 15:24:01 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066070.outbound.protection.outlook.com [40.92.66.70]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 15E0C68B2EA for ; Tue, 1 Feb 2022 15:23:55 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aYuADXLgwmFSSv0GWaxobUX0PvM9Ho35j+xBWksMA2KmwP8Y6CgyO6NtJwpWZ6spzLJirLtlUM3Q7CjGw3fFBop+X89YBbkYbdwNRjfT4xm1U8vfEHqmqSPvO521/68nuIO06U1M0+ONFRTKNf7QOceCRRUGXqrDYvxrlKL2iQu0eJpOSeUutAKcgjpKwpPDP+XOJZQwnhfQsWMaQOmLBLaslVnEzFoU0ddbNCCg+P2yVJZjcndNfGG9z2lPXRl5e8HS8UhQVoNvdHus9Z0sYFGI/hmbEdfmwfD7VPZ6k0dULA3O0kJK2UMRmEdGtu/zO8Fwzyg/7H/oyaRvssCOlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4aaie7ZmOHFzoDvtzhT+byOcLzu1eMfxYG31LzGjtHI=; b=MypsOuvAFtRjLt400Mj7gCi9owQYzPFurfEs1n65XPTtAPJ8JEnXABKIoJ2+jkePNz3pCRXyIcMlMBSFyAgLXe6kEyiXqBMoPPJ2Z2av632CdOYbC1/7cMwANMtExWpdv7t6oSswEPGKs+bifcNZXpe2nrIiyz7Nb0xRGh8/wx10PVbOaKG4o10lCbDwcL+7F/8nD+NLtpm1azcX7Jcbfq/yl6nJdnr4gFXbIDw6l84p6ztf6gX0q95B+baflwOaFswXR8HnxIceFvBhEbZLFB3IaLDdqXEFDsUoICNv+4BUoNAVx4vEv0FvYE2lvz5UlaByW3cXW6QjLGw1kTJZdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4aaie7ZmOHFzoDvtzhT+byOcLzu1eMfxYG31LzGjtHI=; b=T9NluCnZ4zMofYaq2wMNPU7FcCxls6XBSh9j9B0rKm0uTWcsfsZlM0iSDte50DpjSoao7E3gwrOaumDHeA2o/u3O6XcTPXd9/PCuppDqSkEPZatmkhjmbFmsiKZXiQNCJi1sX90xaSRWKMWzyaqr7vn52gCi9qx8xGe6yALA+YKT8mN1dxbw+3dADf7s/QAnXvQRF2a/QOjOVuD9jwTNEIPwClJSkXgxaHV3xCj5KlfMHln+pS/AG20tvDwfqTYTbywHUnI4beTm5WesvitSK/iCfQKBoRTbiSSwjQEPcVdvctFA9PWSgdLM12NwEYpdz70ZBmXc+wm5PdkL4HWGvQ== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM0PR03MB5025.eurprd03.prod.outlook.com (2603:10a6:208:102::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.22; Tue, 1 Feb 2022 13:08:53 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22%6]) with mapi id 15.20.4951.011; Tue, 1 Feb 2022 13:08:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 1 Feb 2022 14:07:00 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [lJogryWbNgQzhXWF3oPjtLzOzDsVTqFM] X-ClientProxiedBy: AM6P195CA0092.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:86::33) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220201130706.1420875-62-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72a5a1e1-049f-4305-5295-08d9e583ff57 X-MS-TrafficTypeDiagnostic: AM0PR03MB5025:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: raOh/3o9bSkK0umiAr9PUs+vdJk2cRHRE/azzYoRL4m40WVX3ZLG3z2SAjOSwazHLbWyrxY8SLS1ooLC6YR7vsFsZ4ujiDqXvM1NGGpzfqOgMKeIAINQcpbhQb59qj8lFI/lPHud3aWAVwt3YDfJtHH9Mqm644Uxl+YHtPuDGuPJwI5YVrSTbMdHckU9AtwI781jEWMAY90tpzmVJah+NI/EqKYk8doFVm4tUp+s0yy+8/F5DqzGMPXuO5xvC531fWkN/pIVk3ABS0+MiZRSs1ZgV/3ai/OHcPjnpCmMLce6+ksflbKMOAPWUC9Uotggi38R29ZcxfLczOJnPy2dzqmVTUoy1RhXHLUtFfSHJF17SmD2j9kjLKYwucXn8jwrGmo6N3PxQKLVbfsNZvAvSzRl9VDgV+RnPHSysXIbPak6JV9yjnPB0Txe6arj5zFScEv3AEZAz667uelXi+dozCBaMf7xjQt0H8n9NgD4nmrePJg6srM2V7WrxoQVyIGkagibPfRMJdduIMD7s/LdCamz7bdSAVfO8r6k8/JfwtGK3FawoP2DVHK5qYDhANiI X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fjYwkbYINKiGVglmxv++z26MrkLMdxUIvp7U/nwW/EVPFjPFSAtOGjeNSuKrmp7tH7MZCSwF2pV9SEcuvcMj8P8pJ85VP1i75m3TUGjuz7fSjnpxnRX0SMykz88ySyWrZ5cDOgj3TxFhK1BFkZ4kyHMmHH4eYE0wrRBLRSz3enZE+8xHF+2jFrsJ9koHXZq4/oqfunJt56dbW525ULM9ggl3KSQpxlWb5CqWx3K8q/aES4XcMfJrqMJLIvqQXwsm0N+BmI7lg8a8jt29R08wjvUhFAj7dK1xQ/IMD5sgtggWPVYIzHUMzqHm2Q1kkrqJUxgscjK/Emrz0ZIzWWYlJDcOS9WM/gbin10Qxg/3DV2paLW2sc9txSRepiQodmdy38rYEmGi1EHL7hAORRChaOVSoiecR1gcb5mIKQ7Tmm5yEkrdXeddoT8IhHZfYAPzV3gl1JQwkkaOuKasqMbonOr5JL/WdbwyPgNedJrP22Z/9wNbmEYEen7yObnAfy2gi0PYQL6XpAd4Z4RAGwJ95O8EHBCYHvk/re08ThRFoh7e6Ntsf2EBxS2LRTq9SglwKk1KXjmX73/SINC1yVorOUB8OyAab6h58euteOYtvrJAj/31UdSYGKrXK9t8SXEeKhdRL7qZ3c9yZ0bPcRUfLmJKBaXlcnxkKElxRm/2Rk6sx31BICxcbNwRVW84uaxP6qpws9rbM7sXInV7iF5xGfmegJgmhpUMSInbUR8aXXufPmmGDK9ScrlbirDE2XOaIdG6zhWOpt6O7ATOH4rlpwAsMQy3bVkj641trEZcASZHbn5m0vmgDjZ0PzYUM5LcVk8zUvkz+2WcuROiHe+nVu8PofrfYYePefT8smcxmKkvy1j8FbNzcCqJSMJ/z1Um05rJUmX6VL5O4h0x93uJ01PN2x4AeRFwErnmjMflSqfUkhzhs6SvxI7yDax3eN4ACkQIkKOhu38siDJwtxFGaQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72a5a1e1-049f-4305-5295-08d9e583ff57 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2022 13:08:53.7975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR03MB5025 Subject: [FFmpeg-devel] [PATCH v2 63/69] avcodec/mpegvideo: Move context_initialized flag to MPVMainContext 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Nc1PZfYhfchP This is not a per-slice property. Also move context_reinit. Signed-off-by: Andreas Rheinhardt --- libavcodec/h261dec.c | 2 +- libavcodec/h263dec.c | 8 ++++---- libavcodec/mpeg12dec.c | 2 +- libavcodec/mpeg4videodec.c | 8 ++++---- libavcodec/mpegvideo.c | 6 +++--- libavcodec/mpegvideo.h | 10 +++++----- libavcodec/mpegvideo_dec.c | 12 ++++++------ libavcodec/rv10.c | 2 +- libavcodec/rv34.c | 14 +++++++------- libavcodec/vc1dec.c | 4 ++-- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c index 8113d2ff7d..8774f4e7ad 100644 --- a/libavcodec/h261dec.c +++ b/libavcodec/h261dec.c @@ -625,7 +625,7 @@ retry: ff_mpv_common_end(m); } - if (!s->context_initialized) { + if (!m->context_initialized) { if ((ret = ff_mpv_common_init(m)) < 0) return ret; diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 20a1348d88..b502878a4a 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -498,7 +498,7 @@ retry: if (ret < 0) return ret; - if (!s->context_initialized) + if (!m->context_initialized) // we need the idct permutation for reading a custom matrix ff_mpv_idct_init(s); @@ -540,7 +540,7 @@ retry: return ret; } - if (!s->context_initialized) { + if (!m->context_initialized) { avctx->pix_fmt = h263_get_format(avctx); if ((ret = ff_mpv_common_init(m)) < 0) return ret; @@ -568,9 +568,9 @@ retry: * an H263EncContext */ if (s->width != avctx->coded_width || s->height != avctx->coded_height || - s->context_reinit) { + m->context_reinit) { /* H.263 could change picture size any time */ - s->context_reinit = 0; + m->context_reinit = 0; ret = ff_set_dimensions(avctx, s->width, s->height); if (ret < 0) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 69d0bb809b..3b21b88337 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1087,7 +1087,7 @@ static int mpeg_decode_update_thread_context(AVCodecContext *avctx, if (avctx == avctx_from || !ctx_from->mpeg_ctx_allocated || - !s1->s.context_initialized) + !s1->context_initialized) return 0; err = ff_mpeg_update_thread_context(avctx, avctx_from); diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 6e3981b523..ca6988fc48 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2324,7 +2324,7 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) return AVERROR_PATCHWELCOME; } if (rgb != ctx->rgb || s->chroma_format != chroma_format) - s->context_reinit = 1; + m->context_reinit = 1; s->avctx->bits_per_raw_sample = bits_per_raw_sample; ctx->rgb = rgb; s->chroma_format = chroma_format; @@ -2340,7 +2340,7 @@ static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) if (width && height) { if (s->width && s->height && (s->width != width || s->height != height)) - s->context_reinit = 1; + m->context_reinit = 1; s->width = width; s->height = height; } @@ -2489,7 +2489,7 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) !(s->width && s->codec_tag == AV_RL32("MP4S"))) { if (s->width && s->height && (s->width != width || s->height != height)) - s->context_reinit = 1; + m->context_reinit = 1; s->width = width; s->height = height; } @@ -3527,7 +3527,7 @@ static int mpeg4_update_thread_context(AVCodecContext *dst, { Mpeg4DecContext *s = dst->priv_data; const Mpeg4DecContext *s1 = src->priv_data; - int init = s->m.s.context_initialized; + int init = s->m.context_initialized; int ret = ff_mpeg_update_thread_context(dst, src); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 0e98680056..be18b428f5 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -737,7 +737,7 @@ av_cold int ff_mpv_common_init(MPVMainContext *m) s->parse_context.state = -1; #endif - s->context_initialized = 1; + m->context_initialized = 1; m->thread_context[0] = s; m->slice_context_count = nb_slices; @@ -814,8 +814,8 @@ void ff_mpv_common_end(MPVMainContext *m) ff_mpv_picture_free(s->avctx, &s->next_picture); ff_mpv_picture_free(s->avctx, &s->new_picture); - s->context_initialized = 0; - s->context_reinit = 0; + m->context_initialized = 0; + m->context_reinit = 0; s->last_picture_ptr = s->next_picture_ptr = s->current_picture_ptr = NULL; diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 8632fadae5..df5a51577a 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -103,7 +103,6 @@ typedef struct MPVContext { /* the following fields are managed internally by the encoder */ /* sequence parameters */ - int context_initialized; int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else int picture_number; //FIXME remove, unclear definition int mb_width, mb_height; ///< number of MBs horizontally & vertically @@ -460,10 +459,6 @@ typedef struct MPVContext { int vbv_ignore_qmax; - /* flag to indicate a reinitialization is required, e.g. after - * a frame size change */ - int context_reinit; - ERContext er; int error_rate; @@ -505,6 +500,11 @@ typedef struct MPVContext { typedef struct MPVMainContext { MPVContext s; + int context_initialized; + /* flag to indicate a reinitialization is required, e.g. after + * a frame size change */ + int context_reinit; + int slice_context_count; ///< number of used thread_contexts /* The first entry of this array points to the above MPVContext. */ MPVContext *thread_context[MAX_THREADS]; diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 57c93de621..a4f751af71 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -66,7 +66,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, // FIXME can parameters change on I-frames? // in that case dst may need a reinit - if (!s->context_initialized) { + if (!m->context_initialized) { void *private_ctx = s->private_ctx; int err; memcpy(s, s1, sizeof(*s)); @@ -77,7 +77,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, s->bitstream_buffer = NULL; s->bitstream_buffer_size = s->allocated_bitstream_buffer_size = 0; - if (s1->context_initialized) { + if (m1->context_initialized) { // s->picture_range_start += MAX_PICTURE_COUNT; // s->picture_range_end += MAX_PICTURE_COUNT; ff_mpv_idct_init(s); @@ -91,7 +91,7 @@ int ff_mpeg_update_thread_context(AVCodecContext *dst, } } - if (s->height != s1->height || s->width != s1->width || s->context_reinit) { + if (s->height != s1->height || s->width != s1->width || m->context_reinit) { s->height = s1->height; s->width = s1->width; if ((ret = ff_mpv_common_frame_size_change(m)) < 0) @@ -202,7 +202,7 @@ int ff_mpv_common_frame_size_change(MPVMainDecContext *m) MPVDecContext *const s = &m->s; int err = 0; - if (!s->context_initialized) + if (!m2->context_initialized) return AVERROR(EINVAL); ff_mpv_free_context_frame(m2); @@ -243,12 +243,12 @@ int ff_mpv_common_frame_size_change(MPVMainDecContext *m) if (err < 0) goto fail; } - s->context_reinit = 0; + m2->context_reinit = 0; return 0; fail: ff_mpv_free_context_frame(m2); - s->context_reinit = 1; + m2->context_reinit = 1; return err; } diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index 1a59b2a578..27e17c8677 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -228,7 +228,7 @@ static int rv20_decode_picture_header(RVDecContext *rv, int whole_size) new_w = rv->orig_width; new_h = rv->orig_height; } - if (new_w != s->width || new_h != s->height || !s->context_initialized) { + if (new_w != s->width || new_h != s->height || !m->context_initialized) { AVRational old_aspect = s->avctx->sample_aspect_ratio; av_log(s->avctx, AV_LOG_DEBUG, "attempting to change resolution to %dx%d\n", new_w, new_h); diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index a3437099b2..4ed23b65dd 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -1384,7 +1384,7 @@ static int rv34_decoder_alloc(RV34DecContext *r) if (!(r->cbp_chroma && r->cbp_luma && r->deblock_coefs && r->intra_types_hist && r->mb_type)) { - r->s.s.context_reinit = 1; + r->s.context_reinit = 1; rv34_decoder_free(r); return AVERROR(ENOMEM); } @@ -1524,10 +1524,10 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte const MPVDecContext *const s1 = &m1->s; int err; - if (dst == src || !s1->context_initialized) + if (dst == src || !m1->context_initialized) return 0; - if (s->height != s1->height || s->width != s1->width || s->context_reinit) { + if (s->height != s1->height || s->width != s1->width || m->context_reinit) { s->height = s1->height; s->width = s1->width; if ((err = ff_mpv_common_frame_size_change(m)) < 0) @@ -1544,7 +1544,7 @@ int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecConte // Do no call ff_mpeg_update_thread_context on a partially initialized // decoder context. - if (!s1->context_initialized) + if (!m1->context_initialized) return 0; return ff_mpeg_update_thread_context(dst, src); @@ -1666,12 +1666,12 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, if (s->mb_num_left > 0 && s->current_picture_ptr) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); - if (!s->context_reinit) + if (!m->context_reinit) ff_er_frame_end(&s->er); ff_mpv_frame_end(m); } - if (s->width != si.width || s->height != si.height || s->context_reinit) { + if (s->width != si.width || s->height != si.height || m->context_reinit) { int err; av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n", @@ -1743,7 +1743,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, } s->mb_x = s->mb_y = 0; ff_thread_finish_setup(s->avctx); - } else if (s->context_reinit) { + } else if (m->context_reinit) { av_log(s->avctx, AV_LOG_ERROR, "Decoder needs full frames to " "reinitialize (start MB is %d).\n", si.start); return AVERROR_INVALIDDATA; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 502ea2bae4..995761700b 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -797,13 +797,13 @@ static int vc1_decode_frame(AVCodecContext *avctx, void *data, } } - if (s->context_initialized && + if (m->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); } - if (!s->context_initialized) { + if (!m->context_initialized) { if ((ret = ff_msmpeg4_decode_init(avctx)) < 0) goto err; if ((ret = ff_vc1_decode_init_alloc_tables(v)) < 0) {