Message ID | GV1P250MB073734C0FD309054518C03468FE02@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM |
---|---|
State | New |
Headers | show
Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1706:b0:1af:cdee:28c5 with SMTP id nv6csp298390pzb; Sat, 11 May 2024 13:54:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIyraEvFVRwKcs03VdJn4vocjZNc1DB4zm3OiraktIiUJ+pndXyZ7PeHShevhzWd97/VJfTOhChcJXCMq4qtjVQUlyi1agS+1pIQ== X-Google-Smtp-Source: AGHT+IF+PkF9ek5gKm6sAXrxYSfBhPOT3qkp2/6hIhEMTvobXn2tK7xf397EYoca52sKWu1mNKMr X-Received: by 2002:a2e:9094:0:b0:2df:4bad:cb7f with SMTP id 38308e7fff4ca-2e51fd4b333mr35783811fa.2.1715460848047; Sat, 11 May 2024 13:54:08 -0700 (PDT) Return-Path: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 4fb4d7f45d1cf-5733c362b1asi3277859a12.501.2024.05.11.13.54.07; Sat, 11 May 2024 13:54:08 -0700 (PDT) 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=LBNJzFfR; 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 6B60268D4FB; Sat, 11 May 2024 23:52:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2104.outbound.protection.outlook.com [40.92.91.104]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCFD168D467 for <ffmpeg-devel@ffmpeg.org>; Sat, 11 May 2024 23:52:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bdNC2SM46ai+z7ZqTCZGlU7yipiAD5MCb+7o74VtlqEpZF88QhnPbGWHBvchsHFCZfN1q93qVtGBzftQuazDgpbm4r4VoVvgHFYv5xtCwot0ZDOdNoO0ev+yWCDaqn3c9qSQkNJ6DO/60muXHEMHAacD3MnBibALrdF6nmgvBV1UR42vJEdlx5tS/LwiRBwFGY0aWrbAF2Lvqdzf7Sxb3Rwnays7SkK4CQreLcSszVteFV+bsTFKBSapeO/e141b2u/lrIuoqHL4P++t+/+Bfrg3CxL+2geYM9vIBgOibH/UP4j0KVPq1tPJ9RpxHdeBn0gTe3BAztFV9RrcQDtGLg== 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=nYiymu08iRUsRjmCTo/W3g1Pu4ujQQR+Gzgf8zciFUw=; b=MIFp0qHKFof1Bm4IuD2QFiOZjEZFzlxoeh3/Q7VTWnMfaj1lnahm7S1p0E71lCwwfnRORtd3/ua8Rs5ixFu99s7LrU8KKmS4ZuMz0Y6ggzR3YidCR+fHJxpaYeZmumzyrszsJRVcWfUhE4E+HtGRHyFySyVi/Fe/INUIaQJ5mKfnDfrOjkq6jyZUJpADPCvx4dYJIauzBf/i8ku2f5qlCbdGYAKo+JdzDuvH/O/QzBaSP+TRmALt/DiyGvBLCqnOBsqFtcTl5F0F2co6qnTfxFE242VtJNtUYxcq0fn+5qB3ndR0qYLcxnBNMpmvxPGEyJchHUsaSk4PkkbDxY6YMQ== 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=nYiymu08iRUsRjmCTo/W3g1Pu4ujQQR+Gzgf8zciFUw=; b=LBNJzFfRNbI7nx7ptG5m/CBkATs5mCkeQvnLF9xQ9QJnTzeN58i3g1SAA8bke7m+RXCAOHuLGP9nl7GUbjxGTxnRGJyGuhwAZk5WcYkpdGDQlnflIUDWj5MukS9Ixb9rBc4coRmQCytAVUIrNg3Kwy/YmBwf1p1OkeNUgBpiHZ38VHtBrH0XgDll4psf+cXOeMO4yuGY4+zB/SYs8Y4u/7DMMYYwo4YW3tfwr1vpuExAdZiGygCWDpWdIPUKw8FEGSnUHEEAI0ljX2B4AvFyMvqNU0bg3JNQuYMFxXkeuXJGP6MsQKqjWo6oXjroY9A6S5UJan2E7emQI9i2OaQMQA== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PR3P250MB0370.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Sat, 11 May 2024 20:52:45 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::d6a1:e3af:a5f1:b614%7]) with mapi id 15.20.7544.052; Sat, 11 May 2024 20:52:45 +0000 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Date: Sat, 11 May 2024 22:50:40 +0200 Message-ID: <GV1P250MB073734C0FD309054518C03468FE02@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> X-Mailer: git-send-email 2.40.1 In-Reply-To: <AS8P250MB074471DDEA29072B2586F0EF8FE02@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> References: <AS8P250MB074471DDEA29072B2586F0EF8FE02@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> X-TMN: [iAMMncvg3UfECNhUemqOuIhVINwTYvjZKz0DTcv23zk=] X-ClientProxiedBy: ZR0P278CA0172.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:45::6) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20240511205135.2411886-15-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PR3P250MB0370:EE_ X-MS-Office365-Filtering-Correlation-Id: 11f27469-97b5-4b3a-7251-08dc71fc4efe X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: t7E9XZZKTDcN+Nj6303edjNNkAdhYd59NTyYXkBECREKF/bXw7297fFmY6EFxPWn1WN9qgMX64PBMGi8MNyAcZQ9hsyW81zZni5OBqLScB/ACOGzSuepXq+Gufoibcd0NY+lgtjEKh7kPjg47qVAjmthwS2XyyD+HyI5VZw+5S2Hpvea1ef9otMAKl5xtbxf46XVqtH7IPmVRweJQHI5taLs1XTF6EvUR9xiaCP+nu/WUbVL0Yy6J39OYMDj+UaWFIE8h6WJJHDvEhAPhbD+9gu4BxEQA2vhDndiblLi6th2PJfXNM2WYPYFvNUfZKG20GS781HYGD7ltOTTAZcNCjcs5jbqMzUOS60QUXF7hOpWWP80azqDKn0Fz2I8fZuEpsm07csDNbAQd+bh7aEqK8POO102yTjFwMe6Brz0LuVC/vGDnmLa/t+GR1PQ2oRJiad7tLj10VZZZV5EtjSHsk41iCA75zv+bRXYRhscS5o7M2ATwbzxdvF2uOEpQJHfem/91HsU3JCqrBcVXd3gm8pPpVby9PxjfrryE+qlNIqAfc44r8LOjK7b0B1vwClFccYkCkPsWexbkaAYNgOwCS1LgFrcSp2vopO3rC1tLutd4nD/5Yken7x25cCEfgGa X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SeUGN9Ok6b+Rr7UGoZWHV/hIE1EU37+EHtjLTHwiebPYMZ2Dv/8uEC6UkHBu5AOficRgwu6h7zgoAhw37YGgqnM6PGVUPdWTYObrNqf2Q4zP/wa08u+TO1282DLNc0iM88xSBAYmn6z7GQTYYJx6ePvndRquKgxRmcCInQqciHmLYw8GHpBsjj1/eTywBYCvNPjKEczfbWeggeP0VmjZIVmIWQnvuX4C4bukm1FHG+E9VX/pt5Bq5wZhaEEEzOZj3NjiWUxoKbCAgFDGextsneEjIo7BpEdQSz3nGdViwNTzoNaYekOtCO9pei7xMZESXVoBQw+JE8Gw7KvxQ+nnVwF05egO78PpnHflfjw2gjinRsSx0vu1m8NTRjCLHcLnz4toKuE8UAhP2r/HXTEgKfQIqOk0e9JMcVFPyqSQzp4zs/AC0ObtAetrec1aycTW2U3Z8ZShKcVuI5FBPgIYsD4gdyvwQJSXbtsGPtGMUWat+cRTm4aVFrkGQUqTYKu9iGa78ew3PKuWSOyuJH5uYSP201hG0mjYXOLSftEDQoY6ayegedmFPTBk7fOqxJOrVgG8/WaNGE1ecgUd0hbk3wZxbf0ypUBQhkjItNCARDo5yk3LB7A95ESborgglef11kb+wwa0GwgGNgasiY2k/+RVMsXmhCPZsI56ptZS0vBgkMCuApqoTMqb/56B06ThR2yLw/IRlbo/66dgW+f6ORoXIi39pPHYkTlCKAT7wleJrbDPv3olkZrFPtw6auBk/YkzvjRQSAoOkUFYndW0zJNssx/wqf12C3hnUYI06KmkpdrwAMM7pyCCnjiheAhsuc5PAwDM3bMMs2Rie2rq0vayxgJ6+tnh+Jqv493dY+mgo8iuj0NV1e80G7ME3ytWUDoJQXvP8VowtdtReqwbsPKbgVZsZ4qjFjdbNOh3oCOiS7xANwMjA6S2ldYYISFno4o69SWlDWR9R25/MJ0dt9SOups8GmAaI5SgPVg+1o/tkzO3lNlhFpLB0G3Q+nj44hGQT5eEzpHYBkxMOkkp85rkcJJqpvXYKoheFwppqlYdf+jRBsy58YKe8U0U/DoAW3V76IaHCQLh3W4uN+xfh7RdCL8Zcm/BTxGmJi0688Lz8qqjLDKnSvRff6Yba5D/y/WmVCK7f2GO+5lD6UDe8mDfUmmQu/ZnD0CjwUZC414XcBYyZo0A+KJkeKv08XnALLtY1FVdCGTXFlsk3QEPKLFqTRNpa0XN7qdl14J23ocKZaLMk/lyFPQVvjdACHAVHJ9kOIBa2VLYFYJyy08NRw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11f27469-97b5-4b3a-7251-08dc71fc4efe X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2024 20:52:45.3415 (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: PR3P250MB0370 Subject: [FFmpeg-devel] [PATCH v2 16/71] avcodec/msmpeg4enc: Only calculate coded_cbp when used X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: pBzq0dorqfFm |
Series |
[FFmpeg-devel,v2,01/71] avcodec/ratecontrol: Fix double free on error
|
expand
|
diff --git a/libavcodec/msmpeg4enc.c b/libavcodec/msmpeg4enc.c index c159256068..5e6bc231d4 100644 --- a/libavcodec/msmpeg4enc.c +++ b/libavcodec/msmpeg4enc.c @@ -389,7 +389,6 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, { int cbp, coded_cbp, i; int pred_x, pred_y; - uint8_t *coded_block; ff_msmpeg4_handle_slices(s); @@ -449,20 +448,10 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, } else { /* compute cbp */ cbp = 0; - coded_cbp = 0; - for (i = 0; i < 6; i++) { - int val, pred; - val = (s->block_last_index[i] >= 1); + for (int i = 0; i < 6; i++) { + int val = (s->block_last_index[i] >= 1); cbp |= val << (5 - i); - if (i < 4) { - /* predict value for close blocks only for luma */ - pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); - *coded_block = val; - val = val ^ pred; - } - coded_cbp |= val << (5 - i); } - if(s->msmpeg4_version<=2){ if (s->pict_type == AV_PICTURE_TYPE_I) { put_bits(&s->pb, @@ -480,6 +469,18 @@ void ff_msmpeg4_encode_mb(MpegEncContext * s, ff_h263_cbpy_tab[cbp>>2][0]); }else{ if (s->pict_type == AV_PICTURE_TYPE_I) { + /* compute coded_cbp; the 0x3 corresponds to chroma cbp; + * luma coded_cbp are set in the loop below */ + coded_cbp = cbp & 0x3; + for (int i = 0; i < 4; i++) { + uint8_t *coded_block; + int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_block); + int val = (s->block_last_index[i] >= 1); + *coded_block = val; + val ^= pred; + coded_cbp |= val << (5 - i); + } + put_bits(&s->pb, ff_msmp4_mb_i_table[coded_cbp][1], ff_msmp4_mb_i_table[coded_cbp][0]); } else {
With this patch, msmpeg4v1 and msmpeg4v2 no longer use MpegEncContext.coded_block. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/msmpeg4enc.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)