TUT HEVC Encoder
ml_intra_cu_depth_pred.h
Go to the documentation of this file.
1#ifndef ML_INTRA_CU_DEPTH_PRED_H_
2#define ML_INTRA_CU_DEPTH_PRED_H_
3/*****************************************************************************
4 * This file is part of Kvazaar HEVC encoder.
5 *
6 * Copyright (c) 2021, Tampere University, ITU/ISO/IEC, project contributors
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without modification,
10 * are permitted provided that the following conditions are met:
11 *
12 * * Redistributions of source code must retain the above copyright notice, this
13 * list of conditions and the following disclaimer.
14 *
15 * * Redistributions in binary form must reproduce the above copyright notice, this
16 * list of conditions and the following disclaimer in the documentation and/or
17 * other materials provided with the distribution.
18 *
19 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
33 ****************************************************************************/
34
35#include <stdio.h>
36#include "global.h" // IWYU pragma: keep
37#include "kvazaar.h"
38
39
40
41
42#define LCU_DEPTH_MAT_SIZE 64
43#define RESTRAINED_FLAG 1
44
45#define pow2(x) ((x)*(x))
46#define CR_XMAX(x_px, block_size, width) (MIN((x_px) + (block_size), (width)) - (x_px))
47#define CR_YMAX(y_px, block_size, height) (MIN((y_px) + (block_size), (height)) - (y_px))
48#define CR_GET_X_LCU(lcu_id, nb_lcu_width) (((lcu_id) % (nb_lcu_width)) << 6)
49#define CR_GET_Y_LCU(lcu_id, nb_lcu_width) (((lcu_id) / (nb_lcu_width)) << 6)
50#define CR_GET_CU_D3(x, y, depth) ((x)*(1 << (3-depth)) + ((y) << (6 - depth)))
51#define CR_GET_CU_D4(x, y, depth) ((x)*(1 << (4-depth)) + ((y) << (8 - depth)))
52#define CR_GET_DEPTH_MIN(x, y, depth_min_mat) *(depth_min_mat + (x >> 3) + ((y >> 3) << 3))
53#define CR_GET_DEPTH_MAX(x, y, depth_max_mat) *(depth_max_mat + (x >> 3) + ((y >> 3) << 3))
54
55typedef struct {
56 int32_t x;
57 int32_t y;
58}vect_2D;
59
60
61 // Structure used for the CTU depth prediction using Machine Learning
62 // in All Intra
63typedef struct {
72
73
74
75/*
76 * brief generic structure used for the features
77 *
78 */
79typedef struct {
80 double variance;
90 int qp;
91 //int NB_pixels;
94
95
96typedef int (*tree_predict)(features_s*, double*, double*);
97
99void kvz_end_ml_intra_depth_const(ml_intra_ctu_pred_t * ml_intra_depth_ctu);
100
101void kvz_lcu_luma_depth_pred(ml_intra_ctu_pred_t* ml_intra_depth_ctu, kvz_pixel* luma_px, int8_t qp);
102
103#endif
Header that is included in every other header.
This file defines the public API of Kvazaar when used as a library.
uint8_t kvz_pixel
Definition: kvazaar.h:95
void kvz_end_ml_intra_depth_const(ml_intra_ctu_pred_t *ml_intra_depth_ctu)
Fee the bufer and structure.
Definition: ml_intra_cu_depth_pred.c:858
ml_intra_ctu_pred_t * kvz_init_ml_intra_depth_const(void)
Allocate the structure and buffer.
Definition: ml_intra_cu_depth_pred.c:827
void kvz_lcu_luma_depth_pred(ml_intra_ctu_pred_t *ml_intra_depth_ctu, kvz_pixel *luma_px, int8_t qp)
Generate the interval of depth predictions based on the luma samples.
Definition: ml_intra_cu_depth_pred.c:1746
int(* tree_predict)(features_s *, double *, double *)
Definition: ml_intra_cu_depth_pred.h:96
Definition: ml_intra_cu_depth_pred.h:79
double neigh_variance_C
Definition: ml_intra_cu_depth_pred.h:88
double var_of_sub_mean
Definition: ml_intra_cu_depth_pred.h:89
int qp
Definition: ml_intra_cu_depth_pred.h:90
double merge_variance
Definition: ml_intra_cu_depth_pred.h:81
double sub_variance_0
Definition: ml_intra_cu_depth_pred.h:82
double neigh_variance_A
Definition: ml_intra_cu_depth_pred.h:86
double sub_variance_3
Definition: ml_intra_cu_depth_pred.h:85
double var_of_sub_var
Definition: ml_intra_cu_depth_pred.h:92
double variance
Definition: ml_intra_cu_depth_pred.h:80
double sub_variance_1
Definition: ml_intra_cu_depth_pred.h:83
double sub_variance_2
Definition: ml_intra_cu_depth_pred.h:84
double neigh_variance_B
Definition: ml_intra_cu_depth_pred.h:87
Definition: ml_intra_cu_depth_pred.h:63
uint8_t * _mat_lower_depth
Definition: ml_intra_cu_depth_pred.h:70
int8_t i_nb_addDepth
Definition: ml_intra_cu_depth_pred.h:65
bool b_extra_up_exp
Definition: ml_intra_cu_depth_pred.h:67
uint8_t * _mat_upper_depth
Definition: ml_intra_cu_depth_pred.h:69
Definition: ml_intra_cu_depth_pred.h:55
int32_t y
Definition: ml_intra_cu_depth_pred.h:57
int32_t x
Definition: ml_intra_cu_depth_pred.h:56