mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
Replace EDGE_ macros with an enum in filter.
Replaces macros EDGE_HOR and EDGE_VER with enum edge_dir.
This commit is contained in:
parent
b6e443f3ce
commit
863bd1c55d
36
src/filter.c
36
src/filter.c
|
@ -166,7 +166,7 @@ INLINE void kvz_filter_deblock_chroma(const encoder_control_t * const encoder, k
|
||||||
*/
|
*/
|
||||||
void kvz_filter_deblock_edge_luma(encoder_state_t * const state,
|
void kvz_filter_deblock_edge_luma(encoder_state_t * const state,
|
||||||
int32_t xpos, int32_t ypos,
|
int32_t xpos, int32_t ypos,
|
||||||
int8_t depth, int8_t dir)
|
int8_t depth, edge_dir dir)
|
||||||
{
|
{
|
||||||
videoframe_t * const frame = state->tile->frame;
|
videoframe_t * const frame = state->tile->frame;
|
||||||
const encoder_control_t * const encoder = state->encoder_control;
|
const encoder_control_t * const encoder = state->encoder_control;
|
||||||
|
@ -355,7 +355,7 @@ void kvz_filter_deblock_edge_luma(encoder_state_t * const state,
|
||||||
*/
|
*/
|
||||||
void kvz_filter_deblock_edge_chroma(encoder_state_t * const state,
|
void kvz_filter_deblock_edge_chroma(encoder_state_t * const state,
|
||||||
int32_t x, int32_t y,
|
int32_t x, int32_t y,
|
||||||
int8_t depth, int8_t dir)
|
int8_t depth, edge_dir dir)
|
||||||
{
|
{
|
||||||
const encoder_control_t * const encoder = state->encoder_control;
|
const encoder_control_t * const encoder = state->encoder_control;
|
||||||
const videoframe_t * const frame = state->tile->frame;
|
const videoframe_t * const frame = state->tile->frame;
|
||||||
|
@ -438,17 +438,22 @@ void kvz_filter_deblock_edge_chroma(encoder_state_t * const state,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief function to split LCU into smaller CU blocks
|
* \brief function to split LCU into smaller CU blocks
|
||||||
* \param encoder the encoder info structure
|
*
|
||||||
* \param xCtb block x-position (as SCU)
|
* \param encoder the encoder info structure
|
||||||
* \param yCtb block y-position (as SCU)
|
* \param x block x-position (as SCU)
|
||||||
* \param depth block depth
|
* \param y block y-position (as SCU)
|
||||||
* \param edge which edge we are filtering
|
* \param depth block depth
|
||||||
|
* \param dir direction of the edges to filter
|
||||||
*
|
*
|
||||||
* This function takes (SCU) block position as input and splits the block
|
* This function takes (SCU) block position as input and splits the block
|
||||||
* until the coded block size has been achived. Calls luma and chroma filtering
|
* until the coded block size has been achived. Calls luma and chroma filtering
|
||||||
* functions for each coded CU size.
|
* functions for each coded CU size.
|
||||||
*/
|
*/
|
||||||
void kvz_filter_deblock_cu(encoder_state_t * const state, int32_t x, int32_t y, int8_t depth, int32_t edge)
|
void kvz_filter_deblock_cu(encoder_state_t * const state,
|
||||||
|
int32_t x,
|
||||||
|
int32_t y,
|
||||||
|
int8_t depth,
|
||||||
|
edge_dir dir)
|
||||||
{
|
{
|
||||||
const videoframe_t * const frame = state->tile->frame;
|
const videoframe_t * const frame = state->tile->frame;
|
||||||
const cu_info_t *cur_cu = kvz_videoframe_get_cu_const(frame, x, y);
|
const cu_info_t *cur_cu = kvz_videoframe_get_cu_const(frame, x, y);
|
||||||
|
@ -468,25 +473,25 @@ void kvz_filter_deblock_cu(encoder_state_t * const state, int32_t x, int32_t y,
|
||||||
assert(depth >= 0); // for clang-analyzer
|
assert(depth >= 0); // for clang-analyzer
|
||||||
change = 1 << (MAX_DEPTH - 1 - depth);
|
change = 1 << (MAX_DEPTH - 1 - depth);
|
||||||
|
|
||||||
kvz_filter_deblock_cu(state, x, y, depth + 1, edge);
|
kvz_filter_deblock_cu(state, x, y, depth + 1, dir);
|
||||||
if(!border_x || border_split_x) {
|
if(!border_x || border_split_x) {
|
||||||
kvz_filter_deblock_cu(state, x + change, y, depth + 1, edge);
|
kvz_filter_deblock_cu(state, x + change, y, depth + 1, dir);
|
||||||
}
|
}
|
||||||
if(!border_y || border_split_y) {
|
if(!border_y || border_split_y) {
|
||||||
kvz_filter_deblock_cu(state, x , y + change, depth + 1, edge);
|
kvz_filter_deblock_cu(state, x , y + change, depth + 1, dir);
|
||||||
}
|
}
|
||||||
if((!border_x && !border_y) || (border_split_x && border_split_y)) {
|
if((!border_x && !border_y) || (border_split_x && border_split_y)) {
|
||||||
kvz_filter_deblock_cu(state, x + change, y + change, depth + 1, edge);
|
kvz_filter_deblock_cu(state, x + change, y + change, depth + 1, dir);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no filtering on borders (where filter would use pixels outside the picture)
|
// no filtering on borders (where filter would use pixels outside the picture)
|
||||||
if ((x == 0 && edge == EDGE_VER) || (y == 0 && edge == EDGE_HOR)) return;
|
if ((x == 0 && dir == EDGE_VER) || (y == 0 && dir == EDGE_HOR)) return;
|
||||||
|
|
||||||
// do the filtering for block edge
|
// do the filtering for block edge
|
||||||
kvz_filter_deblock_edge_luma(state, x*(LCU_WIDTH >> MAX_DEPTH), y*(LCU_WIDTH >> MAX_DEPTH), depth, edge);
|
kvz_filter_deblock_edge_luma(state, x*(LCU_WIDTH >> MAX_DEPTH), y*(LCU_WIDTH >> MAX_DEPTH), depth, dir);
|
||||||
kvz_filter_deblock_edge_chroma(state, x*(LCU_WIDTH >> (MAX_DEPTH + 1)), y*(LCU_WIDTH >> (MAX_DEPTH + 1)), depth, edge);
|
kvz_filter_deblock_edge_chroma(state, x*(LCU_WIDTH >> (MAX_DEPTH + 1)), y*(LCU_WIDTH >> (MAX_DEPTH + 1)), depth, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -522,4 +527,3 @@ void kvz_filter_deblock_lcu(encoder_state_t * const state, int x_px, int y_px)
|
||||||
|
|
||||||
kvz_filter_deblock_cu(state, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_HOR);
|
kvz_filter_deblock_cu(state, lcu.x << MAX_DEPTH, lcu.y << MAX_DEPTH, 0, EDGE_HOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
22
src/filter.h
22
src/filter.h
|
@ -31,17 +31,26 @@
|
||||||
#include "encoderstate.h"
|
#include "encoderstate.h"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Edge direction.
|
||||||
|
*/
|
||||||
|
typedef enum edge_dir {
|
||||||
|
EDGE_VER = 0, // vertical
|
||||||
|
EDGE_HOR = 1, // horizontal
|
||||||
|
} edge_dir;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// FUNCTIONS
|
// FUNCTIONS
|
||||||
// Deblocking
|
// Deblocking
|
||||||
void kvz_filter_deblock_cu(encoder_state_t *state, int32_t x_px, int32_t y_px,
|
void kvz_filter_deblock_cu(encoder_state_t *state, int32_t x_px, int32_t y_px,
|
||||||
int8_t depth, int32_t edge);
|
int8_t depth, edge_dir dir);
|
||||||
void kvz_filter_deblock_edge_luma(encoder_state_t *state,
|
void kvz_filter_deblock_edge_luma(encoder_state_t *state,
|
||||||
int32_t x_pos, int32_t y_pos,
|
int32_t x_pos, int32_t y_pos,
|
||||||
int8_t depth, int8_t dir);
|
int8_t depth, edge_dir dir);
|
||||||
void kvz_filter_deblock_edge_chroma(encoder_state_t *state,
|
void kvz_filter_deblock_edge_chroma(encoder_state_t *state,
|
||||||
int32_t xpos, int32_t ypos,
|
int32_t xpos, int32_t ypos,
|
||||||
int8_t depth, int8_t dir);
|
int8_t depth, edge_dir dir);
|
||||||
void kvz_filter_deblock_lcu(encoder_state_t *state, int x_px, int y_px);
|
void kvz_filter_deblock_lcu(encoder_state_t *state, int x_px, int y_px);
|
||||||
void kvz_filter_deblock_luma(const encoder_control_t * const encoder, kvz_pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
void kvz_filter_deblock_luma(const encoder_control_t * const encoder, kvz_pixel *src, int32_t offset, int32_t tc , int8_t sw,
|
||||||
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
int8_t part_p_nofilter, int8_t part_q_nofilter,
|
||||||
|
@ -50,11 +59,4 @@ void kvz_filter_deblock_luma(const encoder_control_t * const encoder, kvz_pixel
|
||||||
void kvz_filter_deblock_chroma(const encoder_control_t * const encoder, kvz_pixel *src, int32_t offset, int32_t tc,
|
void kvz_filter_deblock_chroma(const encoder_control_t * const encoder, kvz_pixel *src, int32_t offset, int32_t tc,
|
||||||
int8_t part_p_nofilter, int8_t part_q_nofilter);
|
int8_t part_p_nofilter, int8_t part_q_nofilter);
|
||||||
|
|
||||||
// SAO
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// MACROS
|
|
||||||
#define EDGE_VER 0
|
|
||||||
#define EDGE_HOR 1
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue