|
TUT HEVC Encoder
|
Coding Unit data structure and related functions. More...
Go to the source code of this file.
Data Structures | |
| struct | vector2d_t |
| struct | cu_info_t |
| Struct for CU info. More... | |
| struct | cu_array_t |
| struct | lcu_ref_px_t |
| Top and left intra reference pixels for LCU. More... | |
| struct | lcu_t |
Macros | |
| #define | PU_GET_X(part_mode, cu_width, cu_x, i) ((cu_x) + kvz_part_mode_offsets[(part_mode)][(i)][0] * (cu_width) / 4) |
| Get the x coordinate of a PU. More... | |
| #define | PU_GET_Y(part_mode, cu_width, cu_y, i) ((cu_y) + kvz_part_mode_offsets[(part_mode)][(i)][1] * (cu_width) / 4) |
| Get the y coordinate of a PU. More... | |
| #define | PU_GET_W(part_mode, cu_width, i) (kvz_part_mode_sizes[(part_mode)][(i)][0] * (cu_width) / 4) |
| Get the width of a PU. More... | |
| #define | PU_GET_H(part_mode, cu_width, i) (kvz_part_mode_sizes[(part_mode)][(i)][1] * (cu_width) / 4) |
| Get the height of a PU. More... | |
| #define | CU_GET_MV_CAND(cu_info_ptr, reflist) (((reflist) == 0) ? (cu_info_ptr)->inter.mv_cand0 : (cu_info_ptr)->inter.mv_cand1) |
| #define | CU_SET_MV_CAND(cu_info_ptr, reflist, value) |
| #define | CHECKPOINT_CU(prefix_str, cu) |
| #define | SUB_SCU(xy) ((xy) & (LCU_WIDTH - 1)) |
| Return the 7 lowest-order bits of the pixel coordinate. More... | |
| #define | LCU_CU_WIDTH 16 |
| #define | LCU_T_CU_WIDTH (LCU_CU_WIDTH + 1) |
| #define | LCU_CU_OFFSET (LCU_T_CU_WIDTH + 1) |
| #define | SCU_WIDTH (LCU_WIDTH / LCU_CU_WIDTH) |
| #define | LCU_REF_PX_WIDTH (LCU_WIDTH + LCU_WIDTH / 2) |
| #define | LCU_GET_TOP_RIGHT_CU(lcu) (&(lcu)->cu[LCU_T_CU_WIDTH * LCU_T_CU_WIDTH]) |
| Return pointer to the top right reference CU. More... | |
| #define | LCU_GET_CU_AT_PX(lcu, x_px, y_px) (&(lcu)->cu[LCU_CU_OFFSET + ((x_px) >> 2) + ((y_px) >> 2) * LCU_T_CU_WIDTH]) |
| Return pointer to the CU containing a given pixel. More... | |
| #define | CHECKPOINT_LCU(prefix_str, lcu) |
| #define | NUM_CBF_DEPTHS 5 |
| #define | GET_SPLITDATA(CU, curDepth) ((CU)->depth > curDepth) |
| #define | SET_SPLITDATA(CU, flag) { (CU)->split=(flag); } |
Typedefs | |
| typedef struct cu_array_t | cu_array_t |
Enumerations | |
| enum | cu_type_t { CU_NOTSET = 0 , CU_INTRA = 1 , CU_INTER = 2 , CU_PCM = 3 } |
| enum | part_mode_t { SIZE_2Nx2N = 0 , SIZE_2NxN = 1 , SIZE_Nx2N = 2 , SIZE_NxN = 3 , SIZE_2NxnU = 4 , SIZE_2NxnD = 5 , SIZE_nLx2N = 6 , SIZE_nRx2N = 7 } |
Functions | |
| cu_info_t * | kvz_cu_array_at (cu_array_t *cua, unsigned x_px, unsigned y_px) |
| const cu_info_t * | kvz_cu_array_at_const (const cu_array_t *cua, unsigned x_px, unsigned y_px) |
| cu_array_t * | kvz_cu_array_alloc (const int width, const int height) |
| Allocate a CU array. More... | |
| cu_array_t * | kvz_cu_subarray (cu_array_t *base, const unsigned x_offset, const unsigned y_offset, const unsigned width, const unsigned height) |
| void | kvz_cu_array_free (cu_array_t **cua_ptr) |
| cu_array_t * | kvz_cu_array_copy_ref (cu_array_t *cua) |
| Get a new pointer to a cu array. More... | |
| typedef | __attribute__ ((aligned(8))) struct |
| Coefficients of an LCU. More... | |
| void | kvz_cu_array_copy_from_lcu (cu_array_t *dst, int dst_x, int dst_y, const lcu_t *src) |
| Copy an lcu to a cu array. More... | |
| static void | copy_coeffs (const coeff_t *__restrict src, coeff_t *__restrict dest, size_t width) |
| Copy a part of a coeff_t array to another. More... | |
| static unsigned | xy_to_zorder (unsigned width, unsigned x, unsigned y) |
| Convert (x, y) coordinates to z-order index. More... | |
| static int | cbf_is_set (uint16_t cbf, int depth, color_t plane) |
| Check if CBF in a given level >= depth is true. More... | |
| static int | cbf_is_set_any (uint16_t cbf, int depth) |
| Check if CBF in a given level >= depth is true. More... | |
| static void | cbf_set (uint16_t *cbf, int depth, color_t plane) |
| Set CBF in a level to true. More... | |
| static void | cbf_set_conditionally (uint16_t *cbf, uint16_t child_cbfs[3], int depth, color_t plane) |
| Set CBF in a level to true if it is set at a lower level in any of the child_cbfs. More... | |
| static void | cbf_clear (uint16_t *cbf, int depth, color_t plane) |
| Set CBF in a levels <= depth to false. More... | |
| static void | cbf_copy (uint16_t *cbf, uint16_t src, color_t plane) |
| Copy cbf flags. More... | |
Variables | |
| const uint8_t | kvz_part_mode_num_parts [] |
| Number of PUs in a CU. More... | |
| const uint8_t | kvz_part_mode_offsets [][4][2] |
| PU offsets. More... | |
| const uint8_t | kvz_part_mode_sizes [][4][2] |
| PU sizes. More... | |
| lcu_coeff_t | |
| static const uint16_t | cbf_masks [5] = { 0x1f, 0x0f, 0x07, 0x03, 0x1 } |
| #define CHECKPOINT_CU | ( | prefix_str, | |
| cu | |||
| ) |
| #define CHECKPOINT_LCU | ( | prefix_str, | |
| lcu | |||
| ) |
| #define CU_GET_MV_CAND | ( | cu_info_ptr, | |
| reflist | |||
| ) | (((reflist) == 0) ? (cu_info_ptr)->inter.mv_cand0 : (cu_info_ptr)->inter.mv_cand1) |
| #define CU_SET_MV_CAND | ( | cu_info_ptr, | |
| reflist, | |||
| value | |||
| ) |
| #define GET_SPLITDATA | ( | CU, | |
| curDepth | |||
| ) | ((CU)->depth > curDepth) |
| #define LCU_CU_OFFSET (LCU_T_CU_WIDTH + 1) |
| #define LCU_CU_WIDTH 16 |
| #define LCU_GET_CU_AT_PX | ( | lcu, | |
| x_px, | |||
| y_px | |||
| ) | (&(lcu)->cu[LCU_CU_OFFSET + ((x_px) >> 2) + ((y_px) >> 2) * LCU_T_CU_WIDTH]) |
| lcu | pointer to the containing LCU |
| x_px | x-coordinate relative to the upper left corner of the LCU |
| y_px | y-coordinate relative to the upper left corner of the LCU |
| #define LCU_GET_TOP_RIGHT_CU | ( | lcu | ) | (&(lcu)->cu[LCU_T_CU_WIDTH * LCU_T_CU_WIDTH]) |
| #define LCU_T_CU_WIDTH (LCU_CU_WIDTH + 1) |
| #define NUM_CBF_DEPTHS 5 |
| #define PU_GET_H | ( | part_mode, | |
| cu_width, | |||
| i | |||
| ) | (kvz_part_mode_sizes[(part_mode)][(i)][1] * (cu_width) / 4) |
| part_mode | partition mode of the containing CU |
| cu_width | width of the containing CU |
| i | number of the PU |
| #define PU_GET_W | ( | part_mode, | |
| cu_width, | |||
| i | |||
| ) | (kvz_part_mode_sizes[(part_mode)][(i)][0] * (cu_width) / 4) |
| part_mode | partition mode of the containing CU |
| cu_width | width of the containing CU |
| i | number of the PU |
| #define PU_GET_X | ( | part_mode, | |
| cu_width, | |||
| cu_x, | |||
| i | |||
| ) | ((cu_x) + kvz_part_mode_offsets[(part_mode)][(i)][0] * (cu_width) / 4) |
| part_mode | partition mode of the containing CU |
| cu_width | width of the containing CU |
| cu_x | x coordinate of the containing CU |
| i | number of the PU |
| #define PU_GET_Y | ( | part_mode, | |
| cu_width, | |||
| cu_y, | |||
| i | |||
| ) | ((cu_y) + kvz_part_mode_offsets[(part_mode)][(i)][1] * (cu_width) / 4) |
| part_mode | partition mode of the containing CU |
| cu_width | width of the containing CU |
| cu_y | y coordinate of the containing CU |
| i | number of the PU |
| #define SCU_WIDTH (LCU_WIDTH / LCU_CU_WIDTH) |
| #define SET_SPLITDATA | ( | CU, | |
| flag | |||
| ) | { (CU)->split=(flag); } |
| #define SUB_SCU | ( | xy | ) | ((xy) & (LCU_WIDTH - 1)) |
The 7 lower-order bits correspond to the distance from the left or top edge of the containing LCU.
| typedef struct cu_array_t cu_array_t |
| enum cu_type_t |
| enum part_mode_t |
| typedef __attribute__ | ( | (aligned(8)) | ) |
Coefficients inside a single TU are stored in row-major order. TUs themselves are stored in a zig-zag order, so that the coefficients of a TU are contiguous in memory.
Example storage order for a 32x32 pixel TU tree
+------+------+------+------+---------------------------+ | 0 | 16 | 64 | 80 | | | - | - | - | - | | | 15 | 31 | 79 | 95 | | +------+------+------+------+ | | 32 | 48 | 96 | 112 | | | - | - | - | - | | | 47 | 63 | 111 | 127 | | +------+------+------+------+ 256 - 511 | | 128 | 144 | 192 | 208 | | | - | - | - | - | | | 143 | 159 | 207 | 223 | | +------+------+------+------+ | | 160 | 176 | 224 | 240 | | | - | - | - | - | | | 175 | 191 | 239 | 255 | | +------+------+------+------+-------------+------+------+ | 512 | 528 | | | 832 | 848 | | - | - | | | - | - | | 527 | 543 | | | 847 | 863 | +------+------+ 576 - 639 | 768 - 831 +------+------+ | 544 | 560 | | | 864 | 880 | | - | - | | | - | - | | 559 | 575 | | | 879 | 895 | +------+------+-------------+-------------+------+------+ | | | | | | | | | | | | | | | | 640 - 703 | 704 - 767 | 896 - 959 | 960 - 1023 | | | | | | | | | | | | | | | | +-------------+-------------+-------------+-------------+
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
| width | Size of the block to be copied in pixels. |
| src | Pointer to the source array. |
| dest | Pointer to the destination array. |
| cu_array_t * kvz_cu_array_alloc | ( | const int | width, |
| const int | height | ||
| ) |
| width | width of the array in luma pixels |
| height | height of the array in luma pixels |
| cu_info_t * kvz_cu_array_at | ( | cu_array_t * | cua, |
| unsigned | x_px, | ||
| unsigned | y_px | ||
| ) |
| const cu_info_t * kvz_cu_array_at_const | ( | const cu_array_t * | cua, |
| unsigned | x_px, | ||
| unsigned | y_px | ||
| ) |
| void kvz_cu_array_copy_from_lcu | ( | cu_array_t * | dst, |
| int | dst_x, | ||
| int | dst_y, | ||
| const lcu_t * | src | ||
| ) |
All values are in luma pixels.
| dst | destination array |
| dst_x | x-coordinate of the left edge of the copied area in dst |
| dst_y | y-coordinate of the top edge of the copied area in dst |
| src | source lcu |
| cu_array_t * kvz_cu_array_copy_ref | ( | cu_array_t * | cua | ) |
Increment reference count and return the cu array.
| void kvz_cu_array_free | ( | cu_array_t ** | cua_ptr | ) |
| cu_array_t * kvz_cu_subarray | ( | cu_array_t * | base, |
| const unsigned | x_offset, | ||
| const unsigned | y_offset, | ||
| const unsigned | width, | ||
| const unsigned | height | ||
| ) |
|
inlinestatic |
Only works for widths and coordinates divisible by four. Width must be a power of two in range [4..64].
| width | size of the containing block |
| x | x-coordinate |
| y | y-coordinate |
|
static |
|
extern |
Indexed by part_mode_t values.
|
extern |
Indexed by [part mode][PU number][axis].
Units are 1/4 of the width of the CU.
|
extern |
Indexed by [part mode][PU number][axis].
Units are 1/4 of the width of the CU.
| lcu_coeff_t |