From patchwork Thu Feb 3 01:06:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 34084 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp2043515iov; Wed, 2 Feb 2022 17:07:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOnFUDHUZRzhH0RTMHILAzToufiLCjarA1Hk1up8LMeoVUJ4714p84ihOKRReYSlORr3Cx X-Received: by 2002:a17:906:3b9a:: with SMTP id u26mr28078786ejf.125.1643850458170; Wed, 02 Feb 2022 17:07:38 -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 js1si11754517ejc.557.2022.02.02.17.07.37; Wed, 02 Feb 2022 17:07:38 -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="MMat/AsT"; 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 61F3C68B170; Thu, 3 Feb 2022 03:07:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074078.outbound.protection.outlook.com [40.92.74.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4A1668B09C for ; Thu, 3 Feb 2022 03:06:57 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eN0BmelrYJrvDh7sBAPuWalOLW81BCaxnAHZwCWURWnDl52J7sSHQG75tGrY9mdEpWe7y6FZP0LDMEWW6HiOumDvEUvtwo2lKIVrNkH79H2psWOApAIDrDVM7Yrs2HfSQ7xPmpbx/yEeXJtcbsBEuOtVYfzInynN23QEBSS6zauhy6V7VjnN1cR9Hjhi9MbWz1iWa7l7gaDWUbKDUNEIyLo7q6yL61OramAB+Ma4TcdurZi2+lVKOyYgW3pwNB3cq3Tk9bWIuNt7KpJYXADlrUKhbE4vhRLCivDBBO2h8oKouz7AVBq3QbPd+6VH9Zvbvr0MFenENxdLHppWqF7fXA== 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=rF7GEQpjc1mRQcqhfZwDPg3Gq8Z2xoQRpIov3YIGisM=; b=CcUyIba+wsE+T0sPdMEmVeP7H2xdUlj9vpEqGu4PagaWyi0frPHNAKvu/QE1opqgtEGd5jfl+SdxiLTTZJ3vdNobv7EGGUbtyA6ORunQN8DuLGmlEIceVCak6IdWDM3b8elvlSf7Vh1HgO32/raw4fPzNlDn6bxje88nMeUnb/iGNbum6lsY/dExKM/yhCkcbmcCuKZt7RcTqEg/pVSt3N2bwCU41QimctI7OY0muOg9pfL7nuU7GqTWweNEfvXWGdCEVG3T/UKKMs2nHfdwn2j3m9A3X43ovxqq5ZNlDBuGP46wUDZsVMuCSSJ1RyhevujU7muGhT69MAOBgFWGQw== 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=rF7GEQpjc1mRQcqhfZwDPg3Gq8Z2xoQRpIov3YIGisM=; b=MMat/AsTxke/oZ2T/BOX4onI9RgXSr4Yd24eAchNF3U6Hpb9n9xPfQlksY9f6Iqy7Wyo1y0FNHz06fhAiR2upwToefepXUBhzCl1lgNfCWDYwRWWgg6Nc7wZKVlFyP2SMNCkttWZsaGa1QtFeJpWxjqR5Xlpde5xgvmWHdfmhQgA1p4WrlV3jaRkk4W1/1artxXjI19hzQfJNmmZ5yEOQuxqhopkqXXQYZMqsFADSdnY8rlZCAn64hrIBzVHc/pD4K8+1AXpbvJh93pCmRsDIIJG2hoRQv2G9jz0yTk1Kxxce7+ljJhXTltocMCRuJRK6FpeutpY463Jf8xrwW7w9g== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM0PR0302MB3203.eurprd03.prod.outlook.com (2603:10a6:208:11::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.22; Thu, 3 Feb 2022 01:06:45 +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; Thu, 3 Feb 2022 01:06:45 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 3 Feb 2022 02:06:28 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: References: X-TMN: [Fb3AMzUr5WmcGCiEJ1JMRSuayh3VmgRE] X-ClientProxiedBy: AS8PR04CA0125.eurprd04.prod.outlook.com (2603:10a6:20b:127::10) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220203010631.1929837-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 798e04d2-6d83-471d-ddfa-08d9e6b17236 X-MS-Exchange-SLBlob-MailProps: +LiGfBxqLEs6bi2B2Md8122fePlSqn4eMZjbaD/cDyyKwwjlAHcHogy4mgkxEwqsMtxA1p3jnED3T/w2Ynq3S27LmW21JgtrqR1Faxtus0TQxQHM+s4eiCgI3zmlnQUtFnEaH3dhWEo0o6MXrpyKUtZdQ/S/OVGc11JsGLmIY+Dmh/gLEkHwptT//nVRkd+cKjYau+Y0aJfaxkoPSDLfIUTbCwc8V3Xq93COWfOhuIfn6g4rLjqLV6WZJRqh5tPh5gBqpKbyU20BV2XTgi9BnFjfqpIv+TWb9z9hc7RSwh41t2lYSKpszeF1kytss9TZnLf/IuDW2IbRpJAl0XC/lzb8LHgNmT1CTt24xQReUO0/j/uAKdHqqSn3DwWc0Yl4j3yNdvdvCJPD+CWSZ96eKRPg6LvaOAvlo4xm+cqLXpznBPL76VUSmLmE3e4nDjvh/bz9hQeff+xtYHd41lkQifzisV9oD+Oe2jojdJontfr6FzfP0TDZt11u52nPtfBaMxQGrDuV5bhYXtFtM3F1YJub8jSt5qZaTPaIIC8byKo79kO3CjnK+AurlxGB/ZhA+HUoA9wgWfn/IcErEh7ZqEdPAv7WiiqA+QUrpzjcD+ui/cdqgRCSjUFNV4WC6STp6OeKtPyShFZe9nCSgPK7JK77hQ1L7jOlC98JRIiloNP3y3BLdDxgyX7VMb0hsnYQrOUhYMftAKz7dE0pdOr9pqYEkUZGUZ0kIJt1N1eiy0Ls7GA1sA8ac8+DPdfd934OBiOeDVcvOtp/m6aGUOYA9FYPuAUZOLLn X-MS-TrafficTypeDiagnostic: AM0PR0302MB3203:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HPu1sZpoIS514RTCyOXKi5BBw61D41iheZaD3oHgd+iifT56ON92VyKvrqRrsOR/8k0x3nJawaFLH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8tatQydLxiqyUC+czDhycCFtK1jJHyjsIlono1h9hkGrz6SYNkVLX7ilmaYYvTtV6W7Yq1eEfvoDDhbGxfGZGpX6KgyMt0lWRzVpfI3O7q7gjhTxGYBUmLtGyXHuwkHHNJVAGMA5AnZcu/nKaYcSio1YG2aazy5l0Jz56dHl4mv3noq4UKIw1/CIr2GVhu77HkOGxuzX8ZnYNQIzf5KiGXkuLSpNPme++x6f+NKK2sJXqZ4yXd6fDWNe4AbFvNEzC/ayq/N/4Nd+PjMPPPT65fZK50/a1EITGeZHHyj1c0jJAP6jPUERvLDIiLwMJpoTqbiUTECbM4Lr2/4zkK6vge4Y6XolopjyPeJiWUgxTuziiCoZGeqKPd7scj/n8HwZymHVPo9mbGdA/BhQ6rV4TyOgP4qR/eGFZC4vPR3IKFfx8sunCWBeRSA2BRX3+3Lvk4hTNzrIPVH/bRmuzY/C8TBPs0v08ETNw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 798e04d2-6d83-471d-ddfa-08d9e6b17236 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2022 01:06:45.0996 (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: AM0PR0302MB3203 Subject: [FFmpeg-devel] [PATCH 77/80] avcodec/mpegvideo: Move pb_frame to H263DecContext 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: gkm7yw5EDPIt Signed-off-by: Andreas Rheinhardt --- libavcodec/h263dec.h | 1 + libavcodec/intelh263dec.c | 6 +++--- libavcodec/ituh263dec.c | 21 ++++++++++++--------- libavcodec/mpegvideo.h | 1 - 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263dec.h b/libavcodec/h263dec.h index e090f4b39b..7eebffc91c 100644 --- a/libavcodec/h263dec.h +++ b/libavcodec/h263dec.h @@ -44,6 +44,7 @@ typedef struct H263DecContext { MPVMainDecContext m; int (*decode_mb)(MPVDecContext *s, int16_t block[12][64]); // used to avoid a switch + int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) int long_vectors; ///< use horrible H.263v1 long vector mode int ehc_mode; } H263DecContext; diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index f621c9686c..a5cd6dd1de 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -69,7 +69,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *h) return -1; /* SAC: off */ } s->obmc= get_bits1(&s->gb); - s->pb_frame = get_bits1(&s->gb); + h->pb_frame = get_bits1(&s->gb); if (format < 6) { s->width = ff_h263_format[format][0]; @@ -88,7 +88,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *h) if(get_bits1(&s->gb)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits1(&s->gb)) - s->pb_frame = 2; + h->pb_frame = 2; if(get_bits(&s->gb, 5)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits(&s->gb, 5) != 1) @@ -112,7 +112,7 @@ int ff_intel_h263_decode_picture_header(H263DecContext *h) s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */ - if(s->pb_frame){ + if (h->pb_frame) { skip_bits(&s->gb, 3); //temporal reference for B-frame skip_bits(&s->gb, 2); //dbquant } diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 8467746a0e..15365afebc 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -792,6 +792,9 @@ static int set_direct_mv(MPVDecContext *s) int ff_h263_decode_mb(MPVDecContext *s, int16_t block[6][64]) { + /* The following is only allowed because no h263dec-based + * decoder uses slice-threading. */ + const H263DecContext *const h = (H263DecContext*)s; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; int16_t *mot_val; const int xy= s->mb_x + s->mb_y * s->mb_stride; @@ -827,8 +830,8 @@ int ff_h263_decode_mb(MPVDecContext *s, s->mb_intra = ((cbpc & 4) != 0); if (s->mb_intra) goto intra; - if(s->pb_frame && get_bits1(&s->gb)) - pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); + if (h->pb_frame && get_bits1(&s->gb)) + pb_mv_count = h263_get_modb(&s->gb, h->pb_frame, &cbpb); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if (cbpy < 0) { @@ -1037,8 +1040,8 @@ intra: }else s->ac_pred = 0; - if(s->pb_frame && get_bits1(&s->gb)) - pb_mv_count = h263_get_modb(&s->gb, s->pb_frame, &cbpb); + if (h->pb_frame && get_bits1(&s->gb)) + pb_mv_count = h263_get_modb(&s->gb, h->pb_frame, &cbpb); cbpy = get_vlc2(&s->gb, ff_h263_cbpy_vlc.table, CBPY_VLC_BITS, 1); if(cbpy<0){ av_log(s->avctx, AV_LOG_ERROR, "I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); @@ -1049,7 +1052,7 @@ intra: h263_decode_dquant(s); } - pb_mv_count += !!s->pb_frame; + pb_mv_count += !!h->pb_frame; } while(pb_mv_count--){ @@ -1064,7 +1067,7 @@ intra: cbp+=cbp; } - if(s->pb_frame && h263_skip_b_part(s, cbpb) < 0) + if (h->pb_frame && h263_skip_b_part(s, cbpb) < 0) return -1; if(s->obmc && !s->mb_intra){ if(s->pict_type == AV_PICTURE_TYPE_P && s->mb_x+1mb_width && s->mb_num_left != 1) @@ -1161,7 +1164,7 @@ int ff_h263_decode_picture_header(H263DecContext *h) } s->obmc= get_bits1(&s->gb); /* Advanced prediction mode */ - s->pb_frame = get_bits1(&s->gb); + h->pb_frame = get_bits1(&s->gb); s->chroma_qscale= s->qscale = get_bits(&s->gb, 5); skip_bits1(&s->gb); /* Continuous Presence Multipoint mode: off */ @@ -1217,7 +1220,7 @@ int ff_h263_decode_picture_header(H263DecContext *h) switch(s->pict_type){ case 0: s->pict_type= AV_PICTURE_TYPE_I;break; case 1: s->pict_type= AV_PICTURE_TYPE_P;break; - case 2: s->pict_type= AV_PICTURE_TYPE_P;s->pb_frame = 3;break; + case 2: s->pict_type= AV_PICTURE_TYPE_P; h->pb_frame = 3;break; case 3: s->pict_type= AV_PICTURE_TYPE_B;break; case 7: s->pict_type= AV_PICTURE_TYPE_I;break; //ZYGO default: @@ -1321,7 +1324,7 @@ int ff_h263_decode_picture_header(H263DecContext *h) s->mb_height = (s->height + 15) / 16; s->mb_num = s->mb_width * s->mb_height; - if (s->pb_frame) { + if (h->pb_frame) { skip_bits(&s->gb, 3); /* Temporal reference for B-pictures */ if (s->custom_pcf) skip_bits(&s->gb, 2); //extended Temporal reference diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 7be9b889ea..8697f0108c 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -87,7 +87,6 @@ typedef struct MPVContext { int64_t bit_rate; ///< wanted bit rate enum OutputFormat out_format; ///< output format int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions - int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) /* the following codec id fields are deprecated in favor of codec_id */ int h263_plus; ///< H.263+ headers