accel/ivpu: Move recovery work to system_unbound_wq
[drm/drm-misc.git] / drivers / media / platform / allegro-dvt / nal-rbsp.h
blobc72f49fed8d3d3eadaf9d432d62e3e07f4cb5dd2
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2019-2020 Pengutronix, Michael Tretter <kernel@pengutronix.de>
4 */
6 #ifndef __NAL_RBSP_H__
7 #define __NAL_RBSP_H__
9 #include <linux/kernel.h>
10 #include <linux/types.h>
12 struct rbsp;
14 struct nal_rbsp_ops {
15 int (*rbsp_bit)(struct rbsp *rbsp, int *val);
16 int (*rbsp_bits)(struct rbsp *rbsp, int n, unsigned int *val);
17 int (*rbsp_uev)(struct rbsp *rbsp, unsigned int *val);
18 int (*rbsp_sev)(struct rbsp *rbsp, int *val);
21 /**
22 * struct rbsp - State object for handling a raw byte sequence payload
23 * @data: pointer to the data of the rbsp
24 * @size: maximum size of the data of the rbsp
25 * @pos: current bit position inside the rbsp
26 * @num_consecutive_zeros: number of zeros before @pos
27 * @ops: per datatype functions for interacting with the rbsp
28 * @error: an error occurred while handling the rbsp
30 * This struct is passed around the various parsing functions and tracks the
31 * current position within the raw byte sequence payload.
33 * The @ops field allows to separate the operation, i.e., reading/writing a
34 * value from/to that rbsp, from the structure of the NAL unit. This allows to
35 * have a single function for iterating the NAL unit, while @ops has function
36 * pointers for handling each type in the rbsp.
38 struct rbsp {
39 u8 *data;
40 size_t size;
41 unsigned int pos;
42 unsigned int num_consecutive_zeros;
43 struct nal_rbsp_ops *ops;
44 int error;
47 extern struct nal_rbsp_ops write;
48 extern struct nal_rbsp_ops read;
50 void rbsp_init(struct rbsp *rbsp, void *addr, size_t size,
51 struct nal_rbsp_ops *ops);
52 void rbsp_unsupported(struct rbsp *rbsp);
54 void rbsp_bit(struct rbsp *rbsp, int *value);
55 void rbsp_bits(struct rbsp *rbsp, int n, int *value);
56 void rbsp_uev(struct rbsp *rbsp, unsigned int *value);
57 void rbsp_sev(struct rbsp *rbsp, int *value);
59 void rbsp_trailing_bits(struct rbsp *rbsp);
61 #endif /* __NAL_RBSP_H__ */