From 10484bda9f29c33748069b78eecad922c65bb4da Mon Sep 17 00:00:00 2001 From: Ari Lemmetti Date: Wed, 6 Apr 2016 19:55:42 +0300 Subject: [PATCH] Make strategies out of fractional pixel sample functions --- src/inter.c | 12 ++++++------ src/strategies/generic/ipol-generic.c | 4 ++++ src/strategies/generic/ipol-generic.h | 5 ----- src/strategies/strategies-ipol.c | 4 ++++ src/strategies/strategies-ipol.h | 13 +++++++++++++ 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/inter.c b/src/inter.c index a8fd1914..dbf6be94 100644 --- a/src/inter.c +++ b/src/inter.c @@ -61,7 +61,7 @@ static void inter_recon_frac_luma(const encoder_state_t * const state, block_width, block_height, &src); - kvz_sample_quarterpel_luma_generic(state->encoder_control, + kvz_sample_quarterpel_luma(state->encoder_control, src.orig_topleft, src.stride, block_width, @@ -106,7 +106,7 @@ static void inter_recon_14bit_frac_luma(const encoder_state_t * const state, block_width, block_height, &src); - kvz_sample_14bit_quarterpel_luma_generic(state->encoder_control, + kvz_sample_14bit_quarterpel_luma(state->encoder_control, src.orig_topleft, src.stride, block_width, @@ -147,13 +147,13 @@ static void inter_recon_frac_chroma(const encoder_state_t * const state, //Fractional chroma U kvz_get_extended_block(xpos, ypos, (mv_param[0] >> 2) >> 1, (mv_param[1] >> 2) >> 1, state->tile->lcu_offset_x * LCU_WIDTH_C, state->tile->lcu_offset_y * LCU_WIDTH_C, ref->u, ref->width >> 1, ref->height >> 1, FILTER_SIZE_C, block_width, block_height, &src_u); - kvz_sample_octpel_chroma_generic(state->encoder_control, src_u.orig_topleft, src_u.stride, block_width, + kvz_sample_octpel_chroma(state->encoder_control, src_u.orig_topleft, src_u.stride, block_width, block_height, lcu->rec.u + (ypos % LCU_WIDTH_C)*LCU_WIDTH_C + (xpos % LCU_WIDTH_C), LCU_WIDTH_C, mv_frac_x, mv_frac_y, mv_param); //Fractional chroma V kvz_get_extended_block(xpos, ypos, (mv_param[0] >> 2) >> 1, (mv_param[1] >> 2) >> 1, state->tile->lcu_offset_x * LCU_WIDTH_C, state->tile->lcu_offset_y * LCU_WIDTH_C, ref->v, ref->width >> 1, ref->height >> 1, FILTER_SIZE_C, block_width, block_height, &src_v); - kvz_sample_octpel_chroma_generic(state->encoder_control, src_v.orig_topleft, src_v.stride, block_width, + kvz_sample_octpel_chroma(state->encoder_control, src_v.orig_topleft, src_v.stride, block_width, block_height, lcu->rec.v + (ypos % LCU_WIDTH_C)*LCU_WIDTH_C + (xpos % LCU_WIDTH_C), LCU_WIDTH_C, mv_frac_x, mv_frac_y, mv_param); if (src_u.malloc_used) free(src_u.buffer); @@ -198,7 +198,7 @@ static void inter_recon_14bit_frac_chroma(const encoder_state_t * const state, block_width, block_height, &src_u); - kvz_sample_14bit_octpel_chroma_generic(state->encoder_control, + kvz_sample_14bit_octpel_chroma(state->encoder_control, src_u.orig_topleft, src_u.stride, block_width, @@ -223,7 +223,7 @@ static void inter_recon_14bit_frac_chroma(const encoder_state_t * const state, block_width, block_height, &src_v); - kvz_sample_14bit_octpel_chroma_generic(state->encoder_control, + kvz_sample_14bit_octpel_chroma(state->encoder_control, src_v.orig_topleft, src_v.stride, block_width, diff --git a/src/strategies/generic/ipol-generic.c b/src/strategies/generic/ipol-generic.c index bb37323d..f4faa3b8 100644 --- a/src/strategies/generic/ipol-generic.c +++ b/src/strategies/generic/ipol-generic.c @@ -544,6 +544,10 @@ int kvz_strategy_register_ipol_generic(void* opaque, uint8_t bitdepth) success &= kvz_strategyselector_register(opaque, "filter_inter_quarterpel_luma", "generic", 0, &kvz_filter_inter_quarterpel_luma_generic); success &= kvz_strategyselector_register(opaque, "filter_inter_halfpel_chroma", "generic", 0, &kvz_filter_inter_halfpel_chroma_generic); success &= kvz_strategyselector_register(opaque, "filter_inter_octpel_chroma", "generic", 0, &kvz_filter_inter_octpel_chroma_generic); + success &= kvz_strategyselector_register(opaque, "sample_quarterpel_luma", "generic", 0, &kvz_sample_quarterpel_luma_generic); + success &= kvz_strategyselector_register(opaque, "sample_octpel_chroma", "generic", 0, &kvz_sample_octpel_chroma_generic); + success &= kvz_strategyselector_register(opaque, "sample_14bit_quarterpel_luma", "generic", 0, &kvz_sample_14bit_quarterpel_luma_generic); + success &= kvz_strategyselector_register(opaque, "sample_14bit_octpel_chroma", "generic", 0, &kvz_sample_14bit_octpel_chroma_generic); success &= kvz_strategyselector_register(opaque, "get_extended_block", "generic", 0, &kvz_get_extended_block_generic); return success; diff --git a/src/strategies/generic/ipol-generic.h b/src/strategies/generic/ipol-generic.h index 887a4819..2fc8187d 100644 --- a/src/strategies/generic/ipol-generic.h +++ b/src/strategies/generic/ipol-generic.h @@ -32,10 +32,5 @@ int kvz_strategy_register_ipol_generic(void* opaque, uint8_t bitdepth); -//TODO: create strategies from sample functions -void kvz_sample_quarterpel_luma_generic(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, kvz_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); -void kvz_sample_octpel_chroma_generic(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, kvz_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); -void kvz_sample_14bit_quarterpel_luma_generic(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); -void kvz_sample_14bit_octpel_chroma_generic(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); #endif //STRATEGIES_IPOL_GENERIC_H_ diff --git a/src/strategies/strategies-ipol.c b/src/strategies/strategies-ipol.c index ba2373e2..a7895660 100644 --- a/src/strategies/strategies-ipol.c +++ b/src/strategies/strategies-ipol.c @@ -30,6 +30,10 @@ ipol_func *kvz_filter_inter_quarterpel_luma; ipol_func *kvz_filter_inter_halfpel_chroma; ipol_func *kvz_filter_inter_octpel_chroma; epol_func *kvz_get_extended_block; +kvz_sample_quarterpel_luma_func * kvz_sample_quarterpel_luma; +kvz_sample_octpel_chroma_func * kvz_sample_octpel_chroma; +kvz_sample_14bit_quarterpel_luma_func * kvz_sample_14bit_quarterpel_luma; +kvz_sample_14bit_octpel_chroma_func * kvz_sample_14bit_octpel_chroma; int kvz_strategy_register_ipol(void* opaque, uint8_t bitdepth) { diff --git a/src/strategies/strategies-ipol.h b/src/strategies/strategies-ipol.h index 1034b2f0..9444e842 100644 --- a/src/strategies/strategies-ipol.h +++ b/src/strategies/strategies-ipol.h @@ -39,12 +39,21 @@ typedef unsigned(ipol_func)(const encoder_control_t * encoder, kvz_pixel *src, i typedef unsigned(epol_func)(int xpos, int ypos, int mv_x, int mv_y, int off_x, int off_y, kvz_pixel *ref, int ref_width, int ref_height, int filter_size, int width, int height, kvz_extended_block *out); +typedef void(kvz_sample_quarterpel_luma_func)(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, kvz_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); +typedef void(kvz_sample_octpel_chroma_func)(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, kvz_pixel *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); + +typedef void(kvz_sample_14bit_quarterpel_luma_func)(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); +typedef void(kvz_sample_14bit_octpel_chroma_func)(const encoder_control_t * const encoder, kvz_pixel *src, int16_t src_stride, int width, int height, int16_t *dst, int16_t dst_stride, int8_t hor_flag, int8_t ver_flag, const int16_t mv[2]); // Declare function pointers. extern ipol_func * kvz_filter_inter_quarterpel_luma; extern ipol_func * kvz_filter_inter_halfpel_chroma; extern ipol_func * kvz_filter_inter_octpel_chroma; extern epol_func * kvz_get_extended_block; +extern kvz_sample_quarterpel_luma_func * kvz_sample_quarterpel_luma; +extern kvz_sample_octpel_chroma_func * kvz_sample_octpel_chroma; +extern kvz_sample_14bit_quarterpel_luma_func * kvz_sample_14bit_quarterpel_luma; +extern kvz_sample_14bit_octpel_chroma_func * kvz_sample_14bit_octpel_chroma; int kvz_strategy_register_ipol(void* opaque, uint8_t bitdepth); @@ -54,6 +63,10 @@ int kvz_strategy_register_ipol(void* opaque, uint8_t bitdepth); {"filter_inter_quarterpel_luma", (void**) &kvz_filter_inter_quarterpel_luma}, \ {"filter_inter_halfpel_chroma", (void**) &kvz_filter_inter_halfpel_chroma}, \ {"filter_inter_octpel_chroma", (void**) &kvz_filter_inter_octpel_chroma}, \ + {"sample_quarterpel_luma", (void**) &kvz_sample_quarterpel_luma}, \ + {"sample_octpel_chroma", (void**) &kvz_sample_octpel_chroma}, \ + {"sample_14bit_quarterpel_luma", (void**) &kvz_sample_14bit_quarterpel_luma}, \ + {"sample_14bit_octpel_chroma", (void**) &kvz_sample_14bit_octpel_chroma}, \ {"get_extended_block", (void**) &kvz_get_extended_block}, \