From patchwork Sat Sep 10 01:07:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37828 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp1246165pzh; Fri, 9 Sep 2022 18:10:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UwySUvsDYhjY/CX85JeJ3fIOkvfERgixY93JhOBAmPdAAhuhLlc/VZqxLKSLEq2nEedhW X-Received: by 2002:a17:906:8a4e:b0:730:9fcd:d988 with SMTP id gx14-20020a1709068a4e00b007309fcdd988mr11712901ejc.636.1662772208211; Fri, 09 Sep 2022 18:10:08 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id go10-20020a1709070d8a00b0073ce636490esi1701328ejc.272.2022.09.09.18.10.07; Fri, 09 Sep 2022 18:10: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=C+uSDR9V; 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 E1CF968BB6A; Sat, 10 Sep 2022 04:08:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-oln040092068061.outbound.protection.outlook.com [40.92.68.61]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 642BC68BB39 for ; Sat, 10 Sep 2022 04:08:14 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RAeBlYxkfQTcLAoSs2glTkIZlgFstLCJoRnvoKjBU2f37UNPlakcdG4BlBYboOny5bBV9TXhOR8cV7Jr5G8fbjNVh5swxM/os6sdlBk20MC4SPAnQv+fsVdgaoSWGys9YG+Q084TMWodkp1cbU+ayJwaVw6WJUIVZ5I6X17VSHwH1Zuo4gRIRADeh0rQHfWp5mFA24s9kFMZdQWBda6ltuTuy8hRxfazh9fu9vcyt46Oli5sQmjNw32SbNj2PaC510LoTTSw0DH3udltElcIkARkYsJACcxzm+JsAfZB0EqtiugFjLH16TRMpa8sxEi9WzuVxnauCuIYvre+nqkPqA== 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=kdGDRY4+hHO8vRY8sLyVukzVv2iEnDjUpFUZ9978b1Q=; b=NRS1A+NdHMkaRihWG5tBzbixydHUcy/i7IUL0b6LtzcsRHHSnI3xFkCQinmZrQzNnS+vMymNq6XL+NY8Gdn3TYLuhhA7lP3zvQ22PlULiNMEhFdVsgIZgeqVe3jJVd4Ht7VFRCFQPPsR8H3nnkTXP1J9PjwpcgCrrzpm6uajfeTY3bMZJuKAJ2pcCK8hjA8XUX4MR8EjBST2GHOO6O00L5iHUZD9KFKzwCsz0jc6YGe7WRR2/xspG2P+uQA9r0aaCqiKRYP9SEt59VdMjtxqeY8E642A7czAR9M8Uw/Jy0A6ol0+Si+zHq7XQqRKCxlANWLYImVmF8eikd15KdifxQ== 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=kdGDRY4+hHO8vRY8sLyVukzVv2iEnDjUpFUZ9978b1Q=; b=C+uSDR9VNkkFhKIy6z0/JHL0iqv04Uf7gMUqC06sk/eqOrJ31lJEx6sLG2HzGwixjsZiJrMt/wk87PpjnSO6JHVWA+Z+4m6q53V3csc0AEc5XWj0ynRxUrZpb9vDWi6EoFXW8stX4YS7PsLzz6YnyLgvVuciZCJP95vnlz9kiNvVhJoLigK2eh+y3aJDAYwLQTNOpJUi0isVa4/OZtFvh7p62HQUUa67cxgGmpeMHa7keOQ5wni/UiF3i1cKlJOlyMcB7CqO4xd2LUruYwfvm9yXGdFGLvDocuXwKt3ZNLJWYe/FPPTjv4TJXfaQivlqM21rkbDJ1chY1v9dV6VfBQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0242.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Sat, 10 Sep 2022 01:08:10 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::611e:1608:45cb:b58a]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::611e:1608:45cb:b58a%4]) with mapi id 15.20.5612.019; Sat, 10 Sep 2022 01:08:10 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Sep 2022 03:07:29 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [QFZ38pL3GgGGAylyLgIwSdUzaLg0cWP9iRUOzjnawvY=] X-ClientProxiedBy: FR0P281CA0102.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::18) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20220910010729.2961339-17-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0242:EE_ X-MS-Office365-Filtering-Correlation-Id: 50350b62-df55-47d8-70e9-08da92c8edba X-MS-Exchange-SLBlob-MailProps: Z9TzpHVL8qqx1qOpeEIbbCwbJAaGJurKIUPNtvf0xrxux1Nw7Fc4fLOZ6/eooiJF+eN0M2QF721BeRbGeOW8cABckRLanM7Q9N3tuXjoBh4G4Hzo01uFPJx7BVAbqezR2HeiugK8aWNPDyiUfr7SNC2DAfLFgQCXVO/g6+ZwZL1WluPho4p5E0vKQWG/PYGV85qVegQ9t7mwvNMzyjQklAz4ZrtGctKZB/czAMcHBCFfwispFEk8ve8R1IviQptDyHm2nGcH5oyTw3y/lElt2uUwuY/wQJ12DQP/WFYkNOf3B2dMROmpF8kmpneuiIZQuY34kfySuPUu2H6vpOrAceEoFMtKvnUrAVvhzM82Amaq9A0qy1N7PrLaQBAdQL83FFWwsJQ5goO+KKv31CDgsfSnR/rdtqx6NLxwMZy5nbUzzXnc0VHcKTfclt9+de0mSSDHB406Ex5+nGi4+vOlKqM/KQ40DCGJLlUx/L2BtsA2t+mffXKKnMy+KP54broGm5I82ZibxE+03hIHH1azsgo0Box7X76u2dOzzYGjalcMxFkuyot3GmGctAoxoHxVaO8ueJyK6OVYKo1kLFkx62t4r4/8PBv0JqIuTfx6nCTRZou8BHW/3sOFdU/TLXOqGrBtdqhRgFllOEz5xq0Auy4iXv37JqCO+RUfmaJHPhYJoHxcy2xPJlJQXx9Radv3BsjQa7a6SqVb/7qmNenML1/x7GEQYeRdgNdJ+Ol7qpPHQrpLiCu3pskIWlzxUkFqsT6OWpmvlxdWKLy12X6HsEIbd8fYDyHnGQRUAmyQVmkzLZwiSLtwbqmwTCCHGo9iq+7043TjV4fRSbXAN0hjeuURHY34RJFJUVi8X7gRA5p0HU4bNtSyDQ== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r0hG+swLTe5/YQJiplc2PASvqlIQ3QwdHwiT2K9M0A9HP4u4dODKF3cjXo2J3Jn8gFcTd90tJX//+Zx1Puvk8js7zbTvLjoG46vNomi9kfzWYZzI9upUE+CgRPMtd4u0O2lvhHi8jOWSzTsOI/FR9lZoP0lW7UoaSxgPmuugdls2bW9bPeha+gqRBb96UcVfoNYYi3+YbVvrTsn0ZyP4Pi/4Y8CEHhVzmU+Ef/glUYE5T8LgUH4pfLEsxTfkakU0cRoc1pbFM2aisuL1x3PpGY8MCqz4e7ci1KFku+GQJ/mDxKuC2Ai72Uzmc/MaHHpzFwWbRjmSjaBbQtWExJFH4jNSAZnorr+NVjg9J3kz+sp03krtnTyPIR4llxCCFMYDpBJiEjJTTZmS0HV+J7XixkaUQIVo4ufuBqljGF0O4xVmnQQc/Y2cMu96LP2+j0Ku/LjVth2vWjExJzhmsuF+zfyaSZRlkMvRGKUXnl+uUTwmApBvMcr2Qmqo/lONOj2iYaQOG6+9Op74YV8ZzhubJ4hLaa1X53vk2V75AZcpAmfBdhTihMtYulHJR18NqWq95Cn+q2Ui0d3sjwZrHvdvQbNdz3gD3TYs7ruzZhoIItOljq7ZjlwojqYUNByI0QJsOc6+eK6j/1tzk0eSfs6ikA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZVrECa+E7UR9zSJjNVlfDnztOpGZ2pms9qhWCB0bfoZbEQLWJHMNReupG3+JtlIiAPScgmQMv7tvhAuwfg5mBM990OGSBrPTLMrci282E4Mu80lAru76Fooj5kf4fjWIs4oXZViLyQyWleMXnFYufm5wVRlbq3Fhx7RsuoNaUCVkrUjgSnEpHFQtyPIcamrwPxBgXFcoq3feOUFBvplPo7QpJgHIbkp/+xRwtb0l0UuwObdX9OzVQgcBoQx/cfx5PQKJkfkjma9v0L7H+WgDHwT2D+iZ39Ujz+8RcqxUf3Aw2NxRNKiUcl+GmCwBU/CZrO90b3qXBa6I2XkiyBClYbuEE3OVafL8Ze3ZKic+0MZTTU5vVSZfReRjc99aHkj+GwTOwJ22Druv0FsIELhbg8O+0bRCjvgJL3IRc0T2+N6A39HoR2Tl1s39KgoGQ1VaqRbE1LaX0Tpdkp5nMNu+av8cfhmlOUZjVDwdBLOwkXvL5Gne8tkcDZJVDTFhh3t1CAsuWIloKthLOc7KbrsvhgobCSz3aLseb0tmfPcPhrjE5RKtYzpVMwoOsMdidCjK3PvczF1KG6927tOkFXQs6Rhqbb0nPuxAbcMirtn5khUCg1SGurfpZ6I+W5LjJUFZ8uALRBp/JAWikU+qgS0guCaPG6fIO+HJpJQYiHwMRxfPAL/e6BETnpj2mVsuFWoilIxKhSmxEMYvk8uoZcMs2u3P0UGqsYtIutSjPr92HINyvdE5B1suxwU3+NbjRKo9IqBIg0wrF6wYYJjr4zW0kqwsnfVy+RJ3IA8L4+qZWEol/GdZUhtlrAsZDC6MGeDhP9/mVBdhGPxcY2y5jQVt7z9z7wAIC6xd8nBILUFTEbEXIpwYkIKOkdKKUiWEUd123U7K04/91EpeeiVu3X412ToE5hua+Wb36zj4Xkw/IJWq6ptwEn2IltNu0A6yrnF+TsvFwVJyRroLxBdnHFBHvfdg7cHKyZ0Ux/iIdQYa8fs6MfRySdcuJ+PMebmVzSQ+UdC6oZzg8ttVk7eJrac0Trgf3VcHq2tlEqZnw7B3kk6vHcgcEyTMPdZzB7wzOcaffeKMpP0qdSPeTtr9aKyay+QUvowZd5+0vnOqvMNPxBiUMhl+2NpEO0OJXsPcBe8Uq8j6SMvunFpqjjCBc/Gb2mAeDDqMJIq2CkByJIevHNdIm1vk8OwIb5diiAFn86m5DO8oA5Cgk3HM/U/q7vwFvBLQFZX6oON+DMbXp985M0jY7D5SNbbZLwPv4mwPx3tyzEfZWH4DAPDl0gNHFTJioSS3jdbXjZz98qT68iUlt1QmIf49GCd/69x0Sxm9uqYJ X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50350b62-df55-47d8-70e9-08da92c8edba X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2022 01:08:10.7610 (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: PR3P250MB0242 Subject: [FFmpeg-devel] [PATCH 18/18] avcodec/vp8: Add const where appropriate 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: jV52BPzrJPAU Signed-off-by: Andreas Rheinhardt --- libavcodec/vp8.c | 101 ++++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 91f3238245..22707e2f28 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -132,7 +132,7 @@ static void vp8_release_frame(VP8Context *s, VP8Frame *f) } #if CONFIG_VP8_DECODER -static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, VP8Frame *src) +static int vp8_ref_frame(VP8Context *s, VP8Frame *dst, const VP8Frame *src) { int ret; @@ -508,7 +508,7 @@ static void update_refs(VP8Context *s) s->update_altref = ref_to_update(s, update_altref, VP8_FRAME_ALTREF); } -static void copy_chroma(AVFrame *dst, AVFrame *src, int width, int height) +static void copy_chroma(AVFrame *dst, const AVFrame *src, int width, int height) { int i, j; @@ -542,7 +542,8 @@ static int vp7_fade_frame(VP8Context *s, int alpha, int beta) if (!s->keyframe && (alpha || beta)) { int width = s->mb_width * 16; int height = s->mb_height * 16; - AVFrame *src, *dst; + const AVFrame *src; + AVFrame *dst; if (!s->framep[VP8_FRAME_PREVIOUS] || !s->framep[VP8_FRAME_GOLDEN]) { @@ -550,8 +551,8 @@ static int vp7_fade_frame(VP8Context *s, int alpha, int beta) return AVERROR_INVALIDDATA; } - dst = - src = s->framep[VP8_FRAME_PREVIOUS]->tf.f; + src = + dst = s->framep[VP8_FRAME_PREVIOUS]->tf.f; /* preserve the golden frame, write a new previous frame */ if (s->framep[VP8_FRAME_GOLDEN] == s->framep[VP8_FRAME_PREVIOUS]) { @@ -875,7 +876,7 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si } static av_always_inline -void clamp_mv(VP8mvbounds *s, VP8mv *dst, const VP8mv *src) +void clamp_mv(const VP8mvbounds *s, VP8mv *dst, const VP8mv *src) { dst->x = av_clip(src->x, av_clip(s->mv_min.x, INT16_MIN, INT16_MAX), av_clip(s->mv_max.x, INT16_MIN, INT16_MAX)); @@ -942,18 +943,18 @@ const uint8_t *get_submv_prob(uint32_t left, uint32_t top, int is_vp7) * @returns the number of motion vectors parsed (2, 4 or 16) */ static av_always_inline -int decode_splitmvs(VP8Context *s, VPXRangeCoder *c, VP8Macroblock *mb, +int decode_splitmvs(const VP8Context *s, VPXRangeCoder *c, VP8Macroblock *mb, int layout, int is_vp7) { int part_idx; int n, num; - VP8Macroblock *top_mb; - VP8Macroblock *left_mb = &mb[-1]; + const VP8Macroblock *top_mb; + const VP8Macroblock *left_mb = &mb[-1]; const uint8_t *mbsplits_left = vp8_mbsplits[left_mb->partitioning]; const uint8_t *mbsplits_top, *mbsplits_cur, *firstidx; - VP8mv *top_mv; - VP8mv *left_mv = left_mb->bmv; - VP8mv *cur_mv = mb->bmv; + const VP8mv *top_mv; + const VP8mv *left_mv = left_mb->bmv; + const VP8mv *cur_mv = mb->bmv; if (!layout) // layout is inlined, s->mb_layout is not top_mb = &mb[2]; @@ -1046,7 +1047,6 @@ static av_always_inline void vp7_decode_mvs(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y) { - VP8Macroblock *mb_edge[12]; enum { CNT_ZERO, CNT_NEAREST, CNT_NEAR }; enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT }; int idx = CNT_ZERO; @@ -1065,7 +1065,7 @@ void vp7_decode_mvs(VP8Context *s, VP8Macroblock *mb, if (vp7_calculate_mb_offset(mb_x, mb_y, s->mb_width, pred->xoffset, pred->yoffset, !s->profile, &edge_x, &edge_y)) { - VP8Macroblock *edge = mb_edge[i] = s->macroblocks_base + 1 + edge_x + + const VP8Macroblock *edge = s->macroblocks_base + 1 + edge_x + (s->mb_width + 1) * (edge_y + 1); uint32_t mv = AV_RN32A(get_bmv_ptr(edge, vp7_mv_pred[i].subblock)); if (mv) { @@ -1131,7 +1131,7 @@ void vp7_decode_mvs(VP8Context *s, VP8Macroblock *mb, } static av_always_inline -void vp8_decode_mvs(VP8Context *s, VP8mvbounds *mv_bounds, VP8Macroblock *mb, +void vp8_decode_mvs(VP8Context *s, const VP8mvbounds *mv_bounds, VP8Macroblock *mb, int mb_x, int mb_y, int layout) { VP8Macroblock *mb_edge[3] = { 0 /* top */, @@ -1141,7 +1141,7 @@ void vp8_decode_mvs(VP8Context *s, VP8mvbounds *mv_bounds, VP8Macroblock *mb, enum { VP8_EDGE_TOP, VP8_EDGE_LEFT, VP8_EDGE_TOPLEFT }; int idx = CNT_ZERO; int cur_sign_bias = s->sign_bias[mb->ref_frame]; - int8_t *sign_bias = s->sign_bias; + const int8_t *sign_bias = s->sign_bias; VP8mv near_mv[4]; uint8_t cnt[4] = { 0 }; VPXRangeCoder *c = &s->c; @@ -1161,7 +1161,7 @@ void vp8_decode_mvs(VP8Context *s, VP8mvbounds *mv_bounds, VP8Macroblock *mb, /* Process MB on top, left and top-left */ #define MV_EDGE_CHECK(n) \ { \ - VP8Macroblock *edge = mb_edge[n]; \ + const VP8Macroblock *edge = mb_edge[n]; \ int edge_ref = edge->ref_frame; \ if (edge_ref != VP8_FRAME_CURRENT) { \ uint32_t mv = AV_RN32A(&edge->mv); \ @@ -1266,7 +1266,7 @@ void decode_intra4x4_modes(VP8Context *s, VPXRangeCoder *c, VP8Macroblock *mb, } static av_always_inline -void decode_mb_mode(VP8Context *s, VP8mvbounds *mv_bounds, +void decode_mb_mode(VP8Context *s, const VP8mvbounds *mv_bounds, VP8Macroblock *mb, int mb_x, int mb_y, uint8_t *segment, const uint8_t *ref, int layout, int is_vp7) { @@ -1361,7 +1361,7 @@ void decode_mb_mode(VP8Context *s, VP8mvbounds *mv_bounds, static av_always_inline int decode_block_coeffs_internal(VPXRangeCoder *r, int16_t block[16], uint8_t probs[16][3][NUM_DCT_TOKENS - 1], - int i, uint8_t *token_prob, int16_t qmul[2], + int i, const uint8_t *token_prob, const int16_t qmul[2], const uint8_t scan[16], int vp7) { VPXRangeCoder c = *r; @@ -1444,8 +1444,8 @@ int inter_predict_dc(int16_t block[16], int16_t pred[2]) static int vp7_decode_block_coeffs_internal(VPXRangeCoder *r, int16_t block[16], uint8_t probs[16][3][NUM_DCT_TOKENS - 1], - int i, uint8_t *token_prob, - int16_t qmul[2], + int i, const uint8_t *token_prob, + const int16_t qmul[2], const uint8_t scan[16]) { return decode_block_coeffs_internal(r, block, probs, i, @@ -1456,8 +1456,8 @@ static int vp7_decode_block_coeffs_internal(VPXRangeCoder *r, static int vp8_decode_block_coeffs_internal(VPXRangeCoder *r, int16_t block[16], uint8_t probs[16][3][NUM_DCT_TOKENS - 1], - int i, uint8_t *token_prob, - int16_t qmul[2]) + int i, const uint8_t *token_prob, + const int16_t qmul[2]) { return decode_block_coeffs_internal(r, block, probs, i, token_prob, qmul, ff_zigzag_scan, IS_VP8); @@ -1480,10 +1480,10 @@ static int vp8_decode_block_coeffs_internal(VPXRangeCoder *r, static av_always_inline int decode_block_coeffs(VPXRangeCoder *c, int16_t block[16], uint8_t probs[16][3][NUM_DCT_TOKENS - 1], - int i, int zero_nhood, int16_t qmul[2], + int i, int zero_nhood, const int16_t qmul[2], const uint8_t scan[16], int vp7) { - uint8_t *token_prob = probs[i][zero_nhood]; + const uint8_t *token_prob = probs[i][zero_nhood]; if (!vpx_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB return 0; return vp7 ? vp7_decode_block_coeffs_internal(c, block, probs, i, @@ -1568,8 +1568,8 @@ void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VPXRangeCoder *c, } static av_always_inline -void backup_mb_border(uint8_t *top_border, uint8_t *src_y, - uint8_t *src_cb, uint8_t *src_cr, +void backup_mb_border(uint8_t *top_border, const uint8_t *src_y, + const uint8_t *src_cb, const uint8_t *src_cr, ptrdiff_t linesize, ptrdiff_t uvlinesize, int simple) { AV_COPY128(top_border, src_y + 15 * linesize); @@ -1694,7 +1694,7 @@ int check_intra_pred4x4_mode_emuedge(int mode, int mb_x, int mb_y, } static av_always_inline -void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], +void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *const dst[3], VP8Macroblock *mb, int mb_x, int mb_y, int is_vp7) { int x, y, mode, nnz; @@ -1712,14 +1712,14 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], s->hpc.pred16x16[mode](dst[0], s->linesize); } else { uint8_t *ptr = dst[0]; - uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb; + const uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb; const uint8_t lo = is_vp7 ? 128 : 127; const uint8_t hi = is_vp7 ? 128 : 129; - uint8_t tr_top[4] = { lo, lo, lo, lo }; + const uint8_t tr_top[4] = { lo, lo, lo, lo }; // all blocks on the right edge of the macroblock use bottom edge // the top macroblock for their topright edge - uint8_t *tr_right = ptr - s->linesize + 16; + const uint8_t *tr_right = ptr - s->linesize + 16; // if we're on the right edge of the frame, said edge is extended // from the top macroblock @@ -1732,7 +1732,7 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], AV_ZERO128(td->non_zero_count_cache); for (y = 0; y < 4; y++) { - uint8_t *topright = ptr + 4 - s->linesize; + const uint8_t *topright = ptr + 4 - s->linesize; for (x = 0; x < 4; x++) { int copy = 0; ptrdiff_t linesize = s->linesize; @@ -1838,7 +1838,7 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst, int width, int height, ptrdiff_t linesize, vp8_mc_func mc_func[3][3], int is_vp7) { - uint8_t *src = ref->f->data[0]; + const uint8_t *src = ref->f->data[0]; if (AV_RN32A(mv)) { ptrdiff_t src_linesize = linesize; @@ -1898,7 +1898,7 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, int width, int height, ptrdiff_t linesize, vp8_mc_func mc_func[3][3], int is_vp7) { - uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2]; + const uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2]; if (AV_RN32A(mv)) { int mx = mv->x & 7, mx_idx = subpel_idx[0][mx]; @@ -1944,10 +1944,10 @@ void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, } static av_always_inline -void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], - ThreadFrame *ref_frame, int x_off, int y_off, +void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *const dst[3], + const ThreadFrame *ref_frame, int x_off, int y_off, int bx_off, int by_off, int block_w, int block_h, - int width, int height, VP8mv *mv, int is_vp7) + int width, int height, const VP8mv *mv, int is_vp7) { VP8mv uvmv = *mv; @@ -1982,8 +1982,8 @@ void vp8_mc_part(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], /* Fetch pixels for estimated mv 4 macroblocks ahead. * Optimized for 64-byte cache lines. Inspired by ffh264 prefetch_motion. */ static av_always_inline -void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, - int mb_xy, int ref) +void prefetch_motion(const VP8Context *s, const VP8Macroblock *mb, + int mb_x, int mb_y, int mb_xy, int ref) { /* Don't prefetch refs that haven't been used very often this frame. */ if (s->ref_count[ref - 1] > (mb_xy >> 5)) { @@ -2005,13 +2005,13 @@ void prefetch_motion(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, * Apply motion vectors to prediction buffer, chapter 18. */ static av_always_inline -void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], +void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *const dst[3], VP8Macroblock *mb, int mb_x, int mb_y, int is_vp7) { int x_off = mb_x << 4, y_off = mb_y << 4; int width = 16 * s->mb_width, height = 16 * s->mb_height; - ThreadFrame *ref = &s->framep[mb->ref_frame]->tf; - VP8mv *bmv = mb->bmv; + const ThreadFrame *ref = &s->framep[mb->ref_frame]->tf; + const VP8mv *bmv = mb->bmv; switch (mb->partitioning) { case VP8_SPLITMVMODE_NONE: @@ -2089,7 +2089,8 @@ void inter_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], } static av_always_inline -void idct_mb(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3], VP8Macroblock *mb) +void idct_mb(VP8Context *s, VP8ThreadData *td, uint8_t *const dst[3], + const VP8Macroblock *mb) { int x, y, ch; @@ -2151,7 +2152,7 @@ chroma_idct_end: } static av_always_inline -void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, +void filter_level_for_mb(const VP8Context *s, const VP8Macroblock *mb, VP8FilterStrength *f, int is_vp7) { int interior_limit, filter_level; @@ -2184,7 +2185,7 @@ void filter_level_for_mb(VP8Context *s, VP8Macroblock *mb, } static av_always_inline -void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, +void filter_mb(const VP8Context *s, uint8_t *const dst[3], const VP8FilterStrength *f, int mb_x, int mb_y, int is_vp7) { int mbedge_lim, bedge_lim_y, bedge_lim_uv, hev_thresh; @@ -2271,7 +2272,7 @@ void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f, } static av_always_inline -void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f, +void filter_mb_simple(const VP8Context *s, uint8_t *dst, const VP8FilterStrength *f, int mb_x, int mb_y, int is_vp7) { int mbedge_lim, bedge_lim; @@ -2306,7 +2307,7 @@ void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f, #define MARGIN (16 << 2) static av_always_inline int vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, - VP8Frame *prev_frame, int is_vp7) + const VP8Frame *prev_frame, int is_vp7) { VP8Context *s = avctx->priv_data; int mb_x, mb_y; @@ -2343,13 +2344,13 @@ int vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe, } static int vp7_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame, - VP8Frame *prev_frame) + const VP8Frame *prev_frame) { return vp78_decode_mv_mb_modes(avctx, cur_frame, prev_frame, IS_VP7); } static int vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame, - VP8Frame *prev_frame) + const VP8Frame *prev_frame) { return vp78_decode_mv_mb_modes(avctx, cur_frame, prev_frame, IS_VP8); } @@ -2562,7 +2563,7 @@ static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, next_td = &s->thread_data[(jobnr + 1) % num_jobs]; for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) { - VP8FilterStrength *f = &td->filter_strength[mb_x]; + const VP8FilterStrength *f = &td->filter_strength[mb_x]; if (!is_vp7 && prev_td != td) check_thread_pos(td, prev_td, (mb_x + 1) + (s->mb_width + 3), mb_y - 1);