drivers/media/platform/rockchip/rkvdec/rkvdec-cabac.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/rockchip/rkvdec/rkvdec-cabac.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/rockchip/rkvdec/rkvdec-cabac.c- Extension
.c- Size
- 191789 bytes
- Lines
- 2345
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
Dependency Surface
rkvdec-cabac.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Rockchip Video Decoder CABAC tables
*
* Copyright (C) 2023 Collabora, Ltd.
* Sebastian Fricke <sebastian.fricke@collabora.com>
* Copyright (C) 2019 Collabora, Ltd.
* Boris Brezillon <boris.brezillon@collabora.com>
*/
#include "rkvdec-cabac.h"
#define CABAC_ENTRY(ctxidx, idc0_m, idc0_n, idc1_m, idc1_n, \
idc2_m, idc2_n, intra_m, intra_n) \
[0][(ctxidx)] = {idc0_m, idc0_n}, \
[1][(ctxidx)] = {idc1_m, idc1_n}, \
[2][(ctxidx)] = {idc2_m, idc2_n}, \
[3][(ctxidx)] = {intra_m, intra_n}
/*
* Constant CABAC table.
* Built from the tables described in section '9.3.1.1 Initialisation process
* for context variables' of the H264 spec.
*/
const s8 rkvdec_h264_cabac_table[4][464][2] = {
/* Table 9-12 – Values of variables m and n for ctxIdx from 0 to 10 */
CABAC_ENTRY(0, 20, -15, 20, -15, 20, -15, 20, -15),
CABAC_ENTRY(1, 2, 54, 2, 54, 2, 54, 2, 54),
CABAC_ENTRY(2, 3, 74, 3, 74, 3, 74, 3, 74),
CABAC_ENTRY(3, 20, -15, 20, -15, 20, -15, 20, -15),
CABAC_ENTRY(4, 2, 54, 2, 54, 2, 54, 2, 54),
CABAC_ENTRY(5, 3, 74, 3, 74, 3, 74, 3, 74),
CABAC_ENTRY(6, -28, 127, -28, 127, -28, 127, -28, 127),
CABAC_ENTRY(7, -23, 104, -23, 104, -23, 104, -23, 104),
CABAC_ENTRY(8, -6, 53, -6, 53, -6, 53, -6, 53),
CABAC_ENTRY(9, -1, 54, -1, 54, -1, 54, -1, 54),
CABAC_ENTRY(10, 7, 51, 7, 51, 7, 51, 7, 51),
/* Table 9-13 – Values of variables m and n for ctxIdx from 11 to 23 */
CABAC_ENTRY(11, 23, 33, 22, 25, 29, 16, 0, 0),
CABAC_ENTRY(12, 23, 2, 34, 0, 25, 0, 0, 0),
CABAC_ENTRY(13, 21, 0, 16, 0, 14, 0, 0, 0),
CABAC_ENTRY(14, 1, 9, -2, 9, -10, 51, 0, 0),
CABAC_ENTRY(15, 0, 49, 4, 41, -3, 62, 0, 0),
CABAC_ENTRY(16, -37, 118, -29, 118, -27, 99, 0, 0),
CABAC_ENTRY(17, 5, 57, 2, 65, 26, 16, 0, 0),
CABAC_ENTRY(18, -13, 78, -6, 71, -4, 85, 0, 0),
CABAC_ENTRY(19, -11, 65, -13, 79, -24, 102, 0, 0),
CABAC_ENTRY(20, 1, 62, 5, 52, 5, 57, 0, 0),
CABAC_ENTRY(21, 12, 49, 9, 50, 6, 57, 0, 0),
CABAC_ENTRY(22, -4, 73, -3, 70, -17, 73, 0, 0),
CABAC_ENTRY(23, 17, 50, 10, 54, 14, 57, 0, 0),
/* Table 9-14 – Values of variables m and n for ctxIdx from 24 to 39 */
CABAC_ENTRY(24, 18, 64, 26, 34, 20, 40, 0, 0),
CABAC_ENTRY(25, 9, 43, 19, 22, 20, 10, 0, 0),
CABAC_ENTRY(26, 29, 0, 40, 0, 29, 0, 0, 0),
CABAC_ENTRY(27, 26, 67, 57, 2, 54, 0, 0, 0),
CABAC_ENTRY(28, 16, 90, 41, 36, 37, 42, 0, 0),
CABAC_ENTRY(29, 9, 104, 26, 69, 12, 97, 0, 0),
CABAC_ENTRY(30, -46, 127, -45, 127, -32, 127, 0, 0),
CABAC_ENTRY(31, -20, 104, -15, 101, -22, 117, 0, 0),
CABAC_ENTRY(32, 1, 67, -4, 76, -2, 74, 0, 0),
CABAC_ENTRY(33, -13, 78, -6, 71, -4, 85, 0, 0),
CABAC_ENTRY(34, -11, 65, -13, 79, -24, 102, 0, 0),
CABAC_ENTRY(35, 1, 62, 5, 52, 5, 57, 0, 0),
CABAC_ENTRY(36, -6, 86, 6, 69, -6, 93, 0, 0),
CABAC_ENTRY(37, -17, 95, -13, 90, -14, 88, 0, 0),
CABAC_ENTRY(38, -6, 61, 0, 52, -6, 44, 0, 0),
CABAC_ENTRY(39, 9, 45, 8, 43, 4, 55, 0, 0),
/* Table 9-15 – Values of variables m and n for ctxIdx from 40 to 53 */
CABAC_ENTRY(40, -3, 69, -2, 69, -11, 89, 0, 0),
CABAC_ENTRY(41, -6, 81, -5, 82, -15, 103, 0, 0),
CABAC_ENTRY(42, -11, 96, -10, 96, -21, 116, 0, 0),
CABAC_ENTRY(43, 6, 55, 2, 59, 19, 57, 0, 0),
CABAC_ENTRY(44, 7, 67, 2, 75, 20, 58, 0, 0),
CABAC_ENTRY(45, -5, 86, -3, 87, 4, 84, 0, 0),
CABAC_ENTRY(46, 2, 88, -3, 100, 6, 96, 0, 0),
CABAC_ENTRY(47, 0, 58, 1, 56, 1, 63, 0, 0),
CABAC_ENTRY(48, -3, 76, -3, 74, -5, 85, 0, 0),
CABAC_ENTRY(49, -10, 94, -6, 85, -13, 106, 0, 0),
CABAC_ENTRY(50, 5, 54, 0, 59, 5, 63, 0, 0),
CABAC_ENTRY(51, 4, 69, -3, 81, 6, 75, 0, 0),
CABAC_ENTRY(52, -3, 81, -7, 86, -3, 90, 0, 0),
CABAC_ENTRY(53, 0, 88, -5, 95, -1, 101, 0, 0),
/* Table 9-16 – Values of variables m and n for ctxIdx from 54 to 59 */
CABAC_ENTRY(54, -7, 67, -1, 66, 3, 55, 0, 0),
CABAC_ENTRY(55, -5, 74, -1, 77, -4, 79, 0, 0),
Annotation
- Immediate include surface: `rkvdec-cabac.h`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.