From patchwork Thu Jun 30 22:29:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 36569 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:8b27:b0:88:1bbf:7fd2 with SMTP id l39csp621140pzh; Thu, 30 Jun 2022 15:32:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sv67bVnmMI8ySOtycamtXS9PTgZMxYc55TX7Tncm0NwqaBTi1+eVf84eAa2zOU9Qzr/Vxk X-Received: by 2002:a05:6402:4411:b0:437:b723:72 with SMTP id y17-20020a056402441100b00437b7230072mr14673071eda.38.1656628327389; Thu, 30 Jun 2022 15:32:07 -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 d26-20020a50fb1a000000b0043574d16cfbsi478092edq.200.2022.06.30.15.32.06; Thu, 30 Jun 2022 15:32:07 -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=Ux+ZNknb; 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 B54BF68B7FF; Fri, 1 Jul 2022 01:30:53 +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-am6eur05olkn2107.outbound.protection.outlook.com [40.92.91.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A8B8C68B5D7 for ; Fri, 1 Jul 2022 01:30:51 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z+Pj8pBWSrHYH9Dv/sWspjiiNq74ExIjwnHOeo93RYXXacGwc2+aBbJO0nAoudlMf8sDwEULEVXszcn0bBF0jeKfwv1r72+6VIeBItJzsmo7jzlGPX0RB/I3CzpcRDLA/CSJw1BOZhW3ZSP5PUky46BpvegfPtv6dkvrgDMnyryWC+hO+JdNDssBZGCLln00B+FzKry/UAL7l0mzLm3vbWzekeQ2gC0APQvZOEW4+eMuk9gwzkDAQPIyn01jDOCpJg4LjmpxY/hhvpd7kyU8CNW+v6HEUWcDL4MUwUfRJ7z3K8TabmpO1RQ/xBStwU5JidmnSD20chW3/FkYYJdKqA== 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=H49ovzMDXcgHQqWDbHJW7Q6t/v3RS/gekRRng+l83/Y=; b=BP8LGS4SMT+3m2fthcfIiZYamgYoRMDJYG4jZ93CYq1B70o0W7hSOe8qajr6xNhZvV0Uz0wa/dBX2r4rue7NyZV9EWgViukb/8OC8crRUGKyKi8KtmHc5RolZLbNIKpR3+zit1/mw1l4qQIsA78o335oE1leNyrHpkuaSRvgi6NGuxPa0T1oK6LBNlwhJiQkrOvl6u2BDFDf6jBuFPEsRxe3MO36gA6zw4gLut4Zlhe/dFaD/7h+z6K4m5fJbxwWRJQ0XJTnnom6Foo7F6rdo00RPYWo3FBPCEhHBfgTI67pvZe8Lg9QH16dlUXxTrA8UezFsqEgV/xUNrO/Cp7OZw== 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=H49ovzMDXcgHQqWDbHJW7Q6t/v3RS/gekRRng+l83/Y=; b=Ux+ZNknbon3yfSgmBW5eOcKhr84rUpkbj2snF4TCvhHnPtOCEt74IdEL1hZCGRWw1wJaq58XZ/ZwBWFztK0gz3lCtcb998FJhn8FREwzCY8IqA2CYsix/95uN5OnG7zQiTKyaTfVJwIsWZTfthq6Ouv9eyTgKLXmQRqsiJavyxwggAb1DZkSXts4CPKCupjwsdyWfb8oN6RipTNGrxtqI+ev5yqfP+ediveWhpMg8r0HPFspt0Ez0MYkoj3Z+ChLk77Yqh+4JyUZkqBI7eTh1FinHOxfKq4GuPB1qcpp/+9IqWIH0M77bAkmkvlspBPZ8vukoBbTp7urriqKB3i2Jw== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by DB3PR0102MB3546.eurprd01.prod.exchangelabs.com (2603:10a6:8:d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Thu, 30 Jun 2022 22:30:50 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::60b9:9f29:40cc:f01c%10]) with mapi id 15.20.5373.018; Thu, 30 Jun 2022 22:30:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 1 Jul 2022 00:29:43 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [lR4C5ciq4+yfvas8j4w08QHxA8ulXJtz] X-ClientProxiedBy: FR0P281CA0099.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::17) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <20220630222949.1758625-11-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97c859ff-3ba2-4f4b-36d8-08da5ae82f31 X-MS-Exchange-SLBlob-MailProps: /mB5ds43bCHf6fPyxtsjc7j8cf61C9oo5mZHxM18n+KS9EqFqPTFIDC6EMFDMMZUInvO47lfZMxQ5ubsq52rAYrh3oZPzfwvPzS8/RSBwnCXD37qI9WvyqpwLy9MwlDUYrR+cx1Bwj1Nx442nhjdHmVTNddZuPIo2zhPai3j5k/KzGoLCrADtcyMmwTZUL5G5cO3NhaAkdFh9V94p0eHXk4e1lAh/D5L7wtsQZDEBW5svmOpN5dmIlKkcJ6Z7hm7qTFukEc8BPw57LbMvjXVVCikOGdAe5wRS9PsM0Hi2W+9IgrpcZMT2v6G8zeRMbihopzral8mRN+kPK0HsF0CqZ0Kt9jM7/LuIi7dElqdDDUgzvmFSCdeVIgEn8LmzWrZ30/P5rDj11MPHTc96Z6DZhUMx4l1VZTt/jxFiwNkTfuLQHCeyBPCqb57ABPc3spox6cALwL9HlPNkvZFs05Cvgci941vyJ9ZtX+QcQUlWz3hrdRfLpQ1mqbzx53jEAezKEFQQ4liK4iQymQvqE0qpf81h3tbNtXhXPd2r2kU3jpo3bWQjC66sarz/Bd1YqAUaVlBL9Dw9UvXUaRKtxBWBIDs4UTGQMaw5G023TeaTG11xoIaiT71pxJzclgFbImzRSJoXjoXdQkwATAItih6vXk6Po5/HNrxkUZP5cYGSEcA0sOb02sBys6FH6ChF4+0cTc/4cfpUWENOk3/m8ClWKQylvb3PBnCKbl+hoXR+EMzAhM6rnrnqJ4lT6oAXwHIFOEtjObLgjNLHSPHkaH8RRQDiP/Je1BW+pslS7bV8aDfgpuhGcC7C0O1c6AalRzmnEY1ZJUFVZXuCJ8jkcYisVpIPD4TO6YwZtGnEXaGozekNfr+t8ac9/BluM/5ujW91lcMIgVXVUy/uzL4mJwZL+BZ3l9ZCKro6/x0yiS3ZA4= X-MS-TrafficTypeDiagnostic: DB3PR0102MB3546:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X3QygmSkZQ4Owebe2n0Y+v7zgKU2gIRfO7jyKMK6TM/7JJRbfkV4QRzYEarDCmTy67gC9VkFkQFNdMWhxskUx+SLsNZrVT0eAAFNOkwcj0+GGH3XR/NqHIiuY+9wKGDW/uOXOJu05XO+KIHezAv8Fom/f5KteiqQVkUjgBJd2Tx3FD88euZZUhz7OvaVloPIIcZblICkFlKf+53Ve6QXRMz+a1BvI1kBHJDiKCgtCwFNeRA9PhRm2ScvPTbVIwsbfEFJ84DT7JxWXn5ShsJqHCxJZFJrYTUBtZr7d/WXJjYJH2CXdXPfIId8nBznOFePl7H0GuQCRN/uGmSqmLwfIS/Zsmx3KFPvCQX0MN1tjs+Qlhrs6psUTNicFXjuGBaiAbYGLDMComB41JlReO6iG4Hej0AlUfz3LobmLGdEaNpcx4hPB07epUrUid2h7SwW7Od4WN9iZxCtQ3phRu9GyG/X9YxoKZfakeiinV3yQ7RKWawZPpxONXgBK7FIPzA+LQOv8dV8I80fzOK7C2O8MPP7zeLj4jChs5OUXs27vaONxBO5tzbZ3+pSVAV55nL7TYdj4KK9qPIWQtvw1MsiaHpm4Bda5+NpDbCBtxqiOCOSkgL6xQOh5w6AGWb/M2CWcJZECU8+T+LcYy/b3WhvDvrK4PjxkSezaU3GYQ/rhb7Qg/XQ6Fge6jXfeyzDZf/a00dX1Yj1wRngx0d+Ql2UAw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /g2iabP9pvSbr96GFNTFE6wIbDzCvqh6oxcrVsyy/VvE4A7O00Fj67Ztj+dlIM091hcWYC7gACqKldrDR1O6+mpLM/EgnL+KFfeG9TT9WkTWbfSrcOdIdl/V39BE1lMme/qUoLnGocUfQaPqkt6SiOxmGcPNnlob92wLR1RSL3wTKgOpdiPdxNYo5NmnTShuOyilo2gKX33tJsrA3JDy9f+W1RPi261bT5BovvBS5EWAQfI27lVSFb8e2xhaAwlp3r0k14QDQw4n8VPLVBWmdH7Nuvr9kg9XBvJ8Kf8dFgiA3GYS0U6O6OlmH3Gs8i+ijqSUNx1p5VjXhdJjAGcLLaRj7en7QRWhdO3nye5BnHfS2XsDtheb9keq5SPG1fgJyTobwmXqDA1FwWgKVLoe2uaToyoDAJFiFS3tIDM6cSWmEYvFmNZosIlwIgsIaJQgqTPd+UAs3+BigDQYPqF1HXj0DuItVpUxLxp97GnEc/+b5FDNBVtWW54CaTyhaDFj40V4zSoFS+fiGlJ2FCVq6P+zk75n9Sr6ZRKSr1zwdfQLokwPuF/IXklBbiC91b++PwxVCXK22KnXzN+W8WHSKIFuix10BVlwf+5F9sq4VEinCl3uSirvjD1cS25euPe0oOh8k3o5B9ZkZf7tc936FvUNCymRMm6tlBFIRUjMR81DXCg9U3y8LeNkzz5uDUsyF8xVJhmUyGwavExqyBTs9u/Oyh0RYk8k028XCLstZ1rHaqkgxm4q9EtLZ0OZwiFiGZz7231m65aBFAsfjOu13dk/OtDUv4orCznYVP834iqcLbKTTjaRUhdkqwFERKzT62qhet54DpPl0R/kFtRy2l+yVStimE71jNCoF2e32kcxhvb+HS2ZrMyTPQyKYDwklkt0ki/Sa8Gd7QO1xxoEHkAWvjkpMuh1svDsueYd3mCSQYCwdtBrrgDf1ggPRLmW74T5dVE8v5yCtGIjlbd3Tx7V1IBLlfTuSsMi9pybGhfo8C5CwRcmWfh16xKkr+dXBsEIt8OEf8NnOm5xcU4gZKub1F3JpmEdK7bHm4h2dscJjdgli4LFsHiu3XO0fEp+dcWG1ytDj/AQnM09MDP8QmfyG5eq6ZdU76uz1pvKVGodbsGDcZp0BxwnPwJEE/cHHkBGeifvyehZn8NTWIfI2WA8dCxTSOnAZd3z07odMkMNpmqE9oKjPluYox3jX08CQtt7yeif4R5qU516IWksxcMAboVkjO3VVMsDRoqyBWbHqmCNTMYlVnZF/yG1u5Ueg+QCFUYVZc+QjCVimdOxKtwlOyMMtNVh20cMWsVbips= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97c859ff-3ba2-4f4b-36d8-08da5ae82f31 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2022 22:30:49.9825 (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: DB3PR0102MB3546 Subject: [FFmpeg-devel] [PATCH 12/18] avcodec/hevcdec: Pass HEVCLocalContext when slice-threading 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: hLYPkXOfe0O+ The HEVC decoder has both HEVCContext and HEVCLocalContext structures. The latter is supposed to be the structure containing the per-slicethread state. Yet that is not how it is handled in practice: Each HEVCLocalContext has a unique HEVCContext allocated for it and each of these coincides except in exactly one field: The corresponding HEVCLocalContext. This makes it possible to pass the HEVCContext everywhere where logically a HEVCLocalContext should be used. This commit stops doing this for lavc/hevcdec.c itself. It also constifies what can be constified in order to make the nonconst stuff stand out more. Signed-off-by: Andreas Rheinhardt --- libavcodec/hevcdec.c | 184 +++++++++++++++++++++---------------------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 2fd0f3acd3..1d0b80ea48 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -1005,9 +1005,9 @@ do { \ sao->elem = 0; \ } while (0) -static void hls_sao_param(HEVCContext *s, int rx, int ry) +static void hls_sao_param(HEVCLocalContext *lc, int rx, int ry) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int sao_merge_left_flag = 0; int sao_merge_up_flag = 0; SAOParams *sao = &CTB(s->sao, rx, ry); @@ -1079,8 +1079,8 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry) #undef SET_SAO #undef CTB -static int hls_cross_component_pred(HEVCContext *s, int idx) { - HEVCLocalContext *lc = s->HEVClc; +static int hls_cross_component_pred(HEVCLocalContext *lc, int idx) +{ int log2_res_scale_abs_plus1 = ff_hevc_log2_res_scale_abs(lc, idx); if (log2_res_scale_abs_plus1 != 0) { @@ -1095,12 +1095,12 @@ static int hls_cross_component_pred(HEVCContext *s, int idx) { return 0; } -static int hls_transform_unit(HEVCContext *s, int x0, int y0, +static int hls_transform_unit(HEVCLocalContext *lc, int x0, int y0, int xBase, int yBase, int cb_xBase, int cb_yBase, int log2_cb_size, int log2_trafo_size, int blk_idx, int cbf_luma, int *cbf_cb, int *cbf_cr) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; const int log2_trafo_size_c = log2_trafo_size - s->ps.sps->hshift[1]; int i; @@ -1189,7 +1189,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, (lc->tu.chroma_mode_c == 4))); if (lc->tu.cross_pf) { - hls_cross_component_pred(s, 0); + hls_cross_component_pred(lc, 0); } for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { @@ -1218,7 +1218,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, } if (lc->tu.cross_pf) { - hls_cross_component_pred(s, 1); + hls_cross_component_pred(lc, 1); } for (i = 0; i < (s->ps.sps->chroma_format_idc == 2 ? 2 : 1); i++) { if (lc->cu.pred_mode == MODE_INTRA) { @@ -1302,7 +1302,7 @@ static int hls_transform_unit(HEVCContext *s, int x0, int y0, return 0; } -static void set_deblocking_bypass(HEVCContext *s, int x0, int y0, int log2_cb_size) +static void set_deblocking_bypass(const HEVCContext *s, int x0, int y0, int log2_cb_size) { int cb_size = 1 << log2_cb_size; int log2_min_pu_size = s->ps.sps->log2_min_pu_size; @@ -1317,13 +1317,13 @@ static void set_deblocking_bypass(HEVCContext *s, int x0, int y0, int log2_cb_si s->is_pcm[i + j * min_pu_width] = 2; } -static int hls_transform_tree(HEVCContext *s, int x0, int y0, +static int hls_transform_tree(HEVCLocalContext *lc, int x0, int y0, int xBase, int yBase, int cb_xBase, int cb_yBase, int log2_cb_size, int log2_trafo_size, int trafo_depth, int blk_idx, const int *base_cbf_cb, const int *base_cbf_cr) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; uint8_t split_transform_flag; int cbf_cb[2]; int cbf_cr[2]; @@ -1390,7 +1390,7 @@ static int hls_transform_tree(HEVCContext *s, int x0, int y0, #define SUBDIVIDE(x, y, idx) \ do { \ - ret = hls_transform_tree(s, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size, \ + ret = hls_transform_tree(lc, x, y, x0, y0, cb_xBase, cb_yBase, log2_cb_size,\ log2_trafo_size - 1, trafo_depth + 1, idx, \ cbf_cb, cbf_cr); \ if (ret < 0) \ @@ -1415,7 +1415,7 @@ do { cbf_luma = ff_hevc_cbf_luma_decode(lc, trafo_depth); } - ret = hls_transform_unit(s, x0, y0, xBase, yBase, cb_xBase, cb_yBase, + ret = hls_transform_unit(lc, x0, y0, xBase, yBase, cb_xBase, cb_yBase, log2_cb_size, log2_trafo_size, blk_idx, cbf_luma, cbf_cb, cbf_cr); if (ret < 0) @@ -1440,9 +1440,9 @@ do { return 0; } -static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) +static int hls_pcm_sample(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; GetBitContext gb; int cb_size = 1 << log2_cb_size; ptrdiff_t stride0 = s->frame->linesize[0]; @@ -1497,11 +1497,11 @@ static int hls_pcm_sample(HEVCContext *s, int x0, int y0, int log2_cb_size) * @param luma_offset additive offset applied to the luma prediction value */ -static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, +static void luma_mc_uni(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, AVFrame *ref, const Mv *mv, int x_off, int y_off, int block_w, int block_h, int luma_weight, int luma_offset) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; uint8_t *src = ref->data[0]; ptrdiff_t srcstride = ref->linesize[0]; int pic_width = s->ps.sps->width; @@ -1558,11 +1558,11 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, * @param mv1 motion vector1 (relative to block position) to get pixel data from * @param current_mv current motion vector structure */ - static void luma_mc_bi(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, + static void luma_mc_bi(HEVCLocalContext *lc, uint8_t *dst, ptrdiff_t dststride, AVFrame *ref0, const Mv *mv0, int x_off, int y_off, int block_w, int block_h, AVFrame *ref1, const Mv *mv1, struct MvField *current_mv) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; ptrdiff_t src0stride = ref0->linesize[0]; ptrdiff_t src1stride = ref1->linesize[0]; int pic_width = s->ps.sps->width; @@ -1649,11 +1649,12 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, * @param chroma_offset additive offset applied to the chroma prediction value */ -static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, +static void chroma_mc_uni(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststride, uint8_t *src0, ptrdiff_t srcstride, int reflist, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int chroma_weight, int chroma_offset) + int x_off, int y_off, int block_w, int block_h, + const struct MvField *current_mv, int chroma_weight, int chroma_offset) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; const Mv *mv = ¤t_mv->mv[reflist]; @@ -1714,10 +1715,10 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, * @param current_mv current motion vector structure * @param cidx chroma component(cb, cr) */ -static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, - int x_off, int y_off, int block_w, int block_h, struct MvField *current_mv, int cidx) +static void chroma_mc_bi(HEVCLocalContext *lc, uint8_t *dst0, ptrdiff_t dststride, AVFrame *ref0, AVFrame *ref1, + int x_off, int y_off, int block_w, int block_h, const MvField *current_mv, int cidx) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; uint8_t *src1 = ref0->data[cidx+1]; uint8_t *src2 = ref1->data[cidx+1]; ptrdiff_t src1stride = ref0->linesize[cidx+1]; @@ -1726,8 +1727,8 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); int pic_width = s->ps.sps->width >> s->ps.sps->hshift[1]; int pic_height = s->ps.sps->height >> s->ps.sps->vshift[1]; - Mv *mv0 = ¤t_mv->mv[0]; - Mv *mv1 = ¤t_mv->mv[1]; + const Mv *const mv0 = ¤t_mv->mv[0]; + const Mv *const mv1 = ¤t_mv->mv[1]; int hshift = s->ps.sps->hshift[1]; int vshift = s->ps.sps->vshift[1]; @@ -1804,7 +1805,7 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF _mx1, _my1, block_w); } -static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, +static void hevc_await_progress(const HEVCContext *s, HEVCFrame *ref, const Mv *mv, int y0, int height) { if (s->threads_type == FF_THREAD_FRAME ) { @@ -1814,11 +1815,11 @@ static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, } } -static void hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, +static void hevc_luma_mv_mvp_mode(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int part_idx, int merge_idx, MvField *mv) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; enum InterPredIdc inter_pred_idc = PRED_L0; int mvp_flag; @@ -1859,21 +1860,21 @@ static void hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, } } -static void hls_prediction_unit(HEVCContext *s, int x0, int y0, +static void hls_prediction_unit(HEVCLocalContext *lc, int x0, int y0, int nPbW, int nPbH, int log2_cb_size, int partIdx, int idx) { #define POS(c_idx, x, y) \ &s->frame->data[c_idx][((y) >> s->ps.sps->vshift[c_idx]) * s->frame->linesize[c_idx] + \ (((x) >> s->ps.sps->hshift[c_idx]) << s->ps.sps->pixel_shift)] - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int merge_idx = 0; struct MvField current_mv = {{{ 0 }}}; int min_pu_width = s->ps.sps->min_pu_width; MvField *tab_mvf = s->ref->tab_mvf; - RefPicList *refPicList = s->ref->refPicList; + const RefPicList *refPicList = s->ref->refPicList; HEVCFrame *ref0 = NULL, *ref1 = NULL; uint8_t *dst0 = POS(0, x0, y0); uint8_t *dst1 = POS(1, x0, y0); @@ -1899,7 +1900,7 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, ff_hevc_luma_mv_merge_mode(lc, x0, y0, nPbW, nPbH, log2_cb_size, partIdx, merge_idx, ¤t_mv); } else { - hevc_luma_mv_mvp_mode(s, x0, y0, nPbW, nPbH, log2_cb_size, + hevc_luma_mv_mvp_mode(lc, x0, y0, nPbW, nPbH, log2_cb_size, partIdx, merge_idx, ¤t_mv); } @@ -1929,16 +1930,16 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW_c = nPbW >> s->ps.sps->hshift[1]; int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - luma_mc_uni(s, dst0, s->frame->linesize[0], ref0->frame, + luma_mc_uni(lc, dst0, s->frame->linesize[0], ref0->frame, ¤t_mv.mv[0], x0, y0, nPbW, nPbH, s->sh.luma_weight_l0[current_mv.ref_idx[0]], s->sh.luma_offset_l0[current_mv.ref_idx[0]]); if (s->ps.sps->chroma_format_idc) { - chroma_mc_uni(s, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], + chroma_mc_uni(lc, dst1, s->frame->linesize[1], ref0->frame->data[1], ref0->frame->linesize[1], 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][0], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][0]); - chroma_mc_uni(s, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], + chroma_mc_uni(lc, dst2, s->frame->linesize[2], ref0->frame->data[2], ref0->frame->linesize[2], 0, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, s->sh.chroma_weight_l0[current_mv.ref_idx[0]][1], s->sh.chroma_offset_l0[current_mv.ref_idx[0]][1]); } @@ -1948,17 +1949,17 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW_c = nPbW >> s->ps.sps->hshift[1]; int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - luma_mc_uni(s, dst0, s->frame->linesize[0], ref1->frame, + luma_mc_uni(lc, dst0, s->frame->linesize[0], ref1->frame, ¤t_mv.mv[1], x0, y0, nPbW, nPbH, s->sh.luma_weight_l1[current_mv.ref_idx[1]], s->sh.luma_offset_l1[current_mv.ref_idx[1]]); if (s->ps.sps->chroma_format_idc) { - chroma_mc_uni(s, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], + chroma_mc_uni(lc, dst1, s->frame->linesize[1], ref1->frame->data[1], ref1->frame->linesize[1], 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, s->sh.chroma_weight_l1[current_mv.ref_idx[1]][0], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][0]); - chroma_mc_uni(s, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], + chroma_mc_uni(lc, dst2, s->frame->linesize[2], ref1->frame->data[2], ref1->frame->linesize[2], 1, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, s->sh.chroma_weight_l1[current_mv.ref_idx[1]][1], s->sh.chroma_offset_l1[current_mv.ref_idx[1]][1]); } @@ -1968,15 +1969,15 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, int nPbW_c = nPbW >> s->ps.sps->hshift[1]; int nPbH_c = nPbH >> s->ps.sps->vshift[1]; - luma_mc_bi(s, dst0, s->frame->linesize[0], ref0->frame, + luma_mc_bi(lc, dst0, s->frame->linesize[0], ref0->frame, ¤t_mv.mv[0], x0, y0, nPbW, nPbH, ref1->frame, ¤t_mv.mv[1], ¤t_mv); if (s->ps.sps->chroma_format_idc) { - chroma_mc_bi(s, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, + chroma_mc_bi(lc, dst1, s->frame->linesize[1], ref0->frame, ref1->frame, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 0); - chroma_mc_bi(s, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, + chroma_mc_bi(lc, dst2, s->frame->linesize[2], ref0->frame, ref1->frame, x0_c, y0_c, nPbW_c, nPbH_c, ¤t_mv, 1); } } @@ -1985,10 +1986,10 @@ static void hls_prediction_unit(HEVCContext *s, int x0, int y0, /** * 8.4.1 */ -static int luma_intra_pred_mode(HEVCContext *s, int x0, int y0, int pu_size, +static int luma_intra_pred_mode(HEVCLocalContext *lc, int x0, int y0, int pu_size, int prev_intra_luma_pred_flag) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int x_pu = x0 >> s->ps.sps->log2_min_pu_size; int y_pu = y0 >> s->ps.sps->log2_min_pu_size; int min_pu_width = s->ps.sps->min_pu_width; @@ -2065,7 +2066,7 @@ static int luma_intra_pred_mode(HEVCContext *s, int x0, int y0, int pu_size, return intra_pred_mode; } -static av_always_inline void set_ct_depth(HEVCContext *s, int x0, int y0, +static av_always_inline void set_ct_depth(const HEVCContext *s, int x0, int y0, int log2_cb_size, int ct_depth) { int length = (1 << log2_cb_size) >> s->ps.sps->log2_min_cb_size; @@ -2082,10 +2083,10 @@ static const uint8_t tab_mode_idx[] = { 0, 1, 2, 2, 2, 2, 3, 5, 7, 8, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 23, 24, 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 30, 31}; -static void intra_prediction_unit(HEVCContext *s, int x0, int y0, +static void intra_prediction_unit(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 }; uint8_t prev_intra_luma_pred_flag[4]; int split = lc->cu.part_mode == PART_NxN; @@ -2106,7 +2107,7 @@ static void intra_prediction_unit(HEVCContext *s, int x0, int y0, lc->pu.rem_intra_luma_pred_mode = ff_hevc_rem_intra_luma_pred_mode_decode(lc); lc->pu.intra_pred_mode[2 * i + j] = - luma_intra_pred_mode(s, x0 + pb_size * j, y0 + pb_size * i, pb_size, + luma_intra_pred_mode(lc, x0 + pb_size * j, y0 + pb_size * i, pb_size, prev_intra_luma_pred_flag[2 * i + j]); } } @@ -2150,11 +2151,11 @@ static void intra_prediction_unit(HEVCContext *s, int x0, int y0, } } -static void intra_prediction_unit_default_value(HEVCContext *s, +static void intra_prediction_unit_default_value(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int pb_size = 1 << log2_cb_size; int size_in_pus = pb_size >> s->ps.sps->log2_min_pu_size; int min_pu_width = s->ps.sps->min_pu_width; @@ -2173,10 +2174,9 @@ static void intra_prediction_unit_default_value(HEVCContext *s, tab_mvf[(y_pu + j) * min_pu_width + x_pu + k].pred_flag = PF_INTRA; } -static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) +static int hls_coding_unit(HEVCLocalContext *lc, const HEVCContext *s, int x0, int y0, int log2_cb_size) { int cb_size = 1 << log2_cb_size; - HEVCLocalContext *lc = s->HEVClc; int log2_min_cb_size = s->ps.sps->log2_min_cb_size; int length = cb_size >> log2_min_cb_size; int min_cb_width = s->ps.sps->min_cb_width; @@ -2220,8 +2220,8 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) } if (SAMPLE_CTB(s->skip_flag, x_cb, y_cb)) { - hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); - intra_prediction_unit_default_value(s, x0, y0, log2_cb_size); + hls_prediction_unit(lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); + intra_prediction_unit_default_value(lc, x0, y0, log2_cb_size); if (!s->sh.disable_deblocking_filter_flag) ff_hevc_deblocking_boundary_strengths(lc, x0, y0, log2_cb_size); @@ -2244,51 +2244,51 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) pcm_flag = ff_hevc_pcm_flag_decode(lc); } if (pcm_flag) { - intra_prediction_unit_default_value(s, x0, y0, log2_cb_size); - ret = hls_pcm_sample(s, x0, y0, log2_cb_size); + intra_prediction_unit_default_value(lc, x0, y0, log2_cb_size); + ret = hls_pcm_sample(lc, x0, y0, log2_cb_size); if (s->ps.sps->pcm.loop_filter_disable_flag) set_deblocking_bypass(s, x0, y0, log2_cb_size); if (ret < 0) return ret; } else { - intra_prediction_unit(s, x0, y0, log2_cb_size); + intra_prediction_unit(lc, x0, y0, log2_cb_size); } } else { - intra_prediction_unit_default_value(s, x0, y0, log2_cb_size); + intra_prediction_unit_default_value(lc, x0, y0, log2_cb_size); switch (lc->cu.part_mode) { case PART_2Nx2N: - hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); + hls_prediction_unit(lc, x0, y0, cb_size, cb_size, log2_cb_size, 0, idx); break; case PART_2NxN: - hls_prediction_unit(s, x0, y0, cb_size, cb_size / 2, log2_cb_size, 0, idx); - hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx); + hls_prediction_unit(lc, x0, y0, cb_size, cb_size / 2, log2_cb_size, 0, idx); + hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1, idx); break; case PART_Nx2N: - hls_prediction_unit(s, x0, y0, cb_size / 2, cb_size, log2_cb_size, 0, idx - 1); - hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1); + hls_prediction_unit(lc, x0, y0, cb_size / 2, cb_size, log2_cb_size, 0, idx - 1); + hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1, idx - 1); break; case PART_2NxnU: - hls_prediction_unit(s, x0, y0, cb_size, cb_size / 4, log2_cb_size, 0, idx); - hls_prediction_unit(s, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx); + hls_prediction_unit(lc, x0, y0, cb_size, cb_size / 4, log2_cb_size, 0, idx); + hls_prediction_unit(lc, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1, idx); break; case PART_2NxnD: - hls_prediction_unit(s, x0, y0, cb_size, cb_size * 3 / 4, log2_cb_size, 0, idx); - hls_prediction_unit(s, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx); + hls_prediction_unit(lc, x0, y0, cb_size, cb_size * 3 / 4, log2_cb_size, 0, idx); + hls_prediction_unit(lc, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1, idx); break; case PART_nLx2N: - hls_prediction_unit(s, x0, y0, cb_size / 4, cb_size, log2_cb_size, 0, idx - 2); - hls_prediction_unit(s, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2); + hls_prediction_unit(lc, x0, y0, cb_size / 4, cb_size, log2_cb_size, 0, idx - 2); + hls_prediction_unit(lc, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1, idx - 2); break; case PART_nRx2N: - hls_prediction_unit(s, x0, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 0, idx - 2); - hls_prediction_unit(s, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2); + hls_prediction_unit(lc, x0, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 0, idx - 2); + hls_prediction_unit(lc, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1, idx - 2); break; case PART_NxN: - hls_prediction_unit(s, x0, y0, cb_size / 2, cb_size / 2, log2_cb_size, 0, idx - 1); - hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1); - hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1); - hls_prediction_unit(s, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1); + hls_prediction_unit(lc, x0, y0, cb_size / 2, cb_size / 2, log2_cb_size, 0, idx - 1); + hls_prediction_unit(lc, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1, idx - 1); + hls_prediction_unit(lc, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2, idx - 1); + hls_prediction_unit(lc, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3, idx - 1); break; } } @@ -2305,7 +2305,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) lc->cu.max_trafo_depth = lc->cu.pred_mode == MODE_INTRA ? s->ps.sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag : s->ps.sps->max_transform_hierarchy_depth_inter; - ret = hls_transform_tree(s, x0, y0, x0, y0, x0, y0, + ret = hls_transform_tree(lc, x0, y0, x0, y0, x0, y0, log2_cb_size, log2_cb_size, 0, 0, cbf, cbf); if (ret < 0) @@ -2336,10 +2336,10 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) return 0; } -static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, +static int hls_coding_quadtree(HEVCLocalContext *lc, int x0, int y0, int log2_cb_size, int cb_depth) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; const int cb_size = 1 << log2_cb_size; int ret; int split_cu; @@ -2371,23 +2371,23 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, int more_data = 0; - more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1); + more_data = hls_coding_quadtree(lc, x0, y0, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; if (more_data && x1 < s->ps.sps->width) { - more_data = hls_coding_quadtree(s, x1, y0, log2_cb_size - 1, cb_depth + 1); + more_data = hls_coding_quadtree(lc, x1, y0, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; } if (more_data && y1 < s->ps.sps->height) { - more_data = hls_coding_quadtree(s, x0, y1, log2_cb_size - 1, cb_depth + 1); + more_data = hls_coding_quadtree(lc, x0, y1, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; } if (more_data && x1 < s->ps.sps->width && y1 < s->ps.sps->height) { - more_data = hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1); + more_data = hls_coding_quadtree(lc, x1, y1, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; } @@ -2402,7 +2402,7 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, else return 0; } else { - ret = hls_coding_unit(s, x0, y0, log2_cb_size); + ret = hls_coding_unit(lc, s, x0, y0, log2_cb_size); if (ret < 0) return ret; if ((!((x0 + cb_size) % @@ -2421,10 +2421,10 @@ static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, return 0; } -static void hls_decode_neighbour(HEVCContext *s, int x_ctb, int y_ctb, +static void hls_decode_neighbour(HEVCLocalContext *lc, int x_ctb, int y_ctb, int ctb_addr_ts) { - HEVCLocalContext *lc = s->HEVClc; + const HEVCContext *const s = lc->parent; int ctb_size = 1 << s->ps.sps->log2_ctb_size; int ctb_addr_rs = s->ps.pps->ctb_addr_ts_to_rs[ctb_addr_ts]; int ctb_addr_in_slice = ctb_addr_rs - s->sh.slice_addr; @@ -2499,7 +2499,7 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) x_ctb = (ctb_addr_rs % ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; y_ctb = (ctb_addr_rs / ((s->ps.sps->width + ctb_size - 1) >> s->ps.sps->log2_ctb_size)) << s->ps.sps->log2_ctb_size; - hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts); + hls_decode_neighbour(lc, x_ctb, y_ctb, ctb_addr_ts); ret = ff_hevc_cabac_init(lc, ctb_addr_ts); if (ret < 0) { @@ -2507,13 +2507,13 @@ static int hls_decode_entry(AVCodecContext *avctxt, void *isFilterThread) return ret; } - hls_sao_param(s, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size); + hls_sao_param(lc, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size); s->deblock[ctb_addr_rs].beta_offset = s->sh.beta_offset; s->deblock[ctb_addr_rs].tc_offset = s->sh.tc_offset; s->filter_slice_edges[ctb_addr_rs] = s->sh.slice_loop_filter_across_slices_enabled_flag; - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + more_data = hls_coding_quadtree(lc, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); if (more_data < 0) { s->tab_slice_address[ctb_addr_rs] = -1; return more_data; @@ -2570,7 +2570,7 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int int x_ctb = (ctb_addr_rs % s->ps.sps->ctb_width) << s->ps.sps->log2_ctb_size; int y_ctb = (ctb_addr_rs / s->ps.sps->ctb_width) << s->ps.sps->log2_ctb_size; - hls_decode_neighbour(s, x_ctb, y_ctb, ctb_addr_ts); + hls_decode_neighbour(lc, x_ctb, y_ctb, ctb_addr_ts); ff_thread_await_progress2(s->avctx, ctb_row, thread, SHIFT_CTB_WPP); @@ -2582,8 +2582,8 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *input_ctb_row, int ret = ff_hevc_cabac_init(lc, ctb_addr_ts); if (ret < 0) goto error; - hls_sao_param(s, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size); - more_data = hls_coding_quadtree(s, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); + hls_sao_param(lc, x_ctb >> s->ps.sps->log2_ctb_size, y_ctb >> s->ps.sps->log2_ctb_size); + more_data = hls_coding_quadtree(lc, x_ctb, y_ctb, s->ps.sps->log2_ctb_size, 0); if (more_data < 0) { ret = more_data;