From e1bcd8e9633063ac9e9f082db96eafdb0b5c4527 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 26 Oct 2017 10:49:22 -0700 Subject: add access to internal functions --- include/rfxcodec_encode.h | 34 ++++++++++++++++++++++++++++++++++ src/rfxencode.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/include/rfxcodec_encode.h b/include/rfxcodec_encode.h index 1f9082d..2c5876f 100644 --- a/include/rfxcodec_encode.h +++ b/include/rfxcodec_encode.h @@ -73,4 +73,38 @@ rfxcodec_encode_ex(void *handle, char *cdata, int *cdata_bytes, const struct rfx_tile *tiles, int num_tiles, const char *quants, int num_quants, int flags); +/* use simple types here, no sint16_t, uint8_t, ... */ +typedef int (*rfxencode_rlgr1_proc)(const short *data, unsigned char *buffer, int buffer_size); +typedef int (*rfxencode_rlgr3_proc)(const short *data, unsigned char *buffer, int buffer_size); +typedef int (*rfxencode_differential_proc)(short *buffer, int buffer_size); +typedef int (*rfxencode_quantization_proc)(short *buffer, const char *quantization_values); +typedef int (*rfxencode_dwt_2d_proc)(const unsigned char *in_buffer, short *buffer, short *dwt_buffer); + +typedef int (*rfxencode_diff_rlgr1_proc)(short *coef, unsigned char *cdata, int cdata_size); +typedef int (*rfxencode_diff_rlgr3_proc)(short *coef, unsigned char *cdata, int cdata_size); + +typedef int (*rfxencode_dwt_shift_x86_sse2_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer); +typedef int (*rfxencode_dwt_shift_x86_sse41_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer); + +typedef int (*rfxencode_dwt_shift_amd64_sse2_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer); +typedef int (*rfxencode_dwt_shift_amd64_sse41_proc)(const char *qtable, const unsigned char *data, short *dwt_buffer1, short *dwt_buffer); + +struct rfxcodec_encode_internals +{ + rfxencode_rlgr1_proc rfxencode_rlgr1; + rfxencode_rlgr3_proc rfxencode_rlgr3; + rfxencode_differential_proc rfxencode_differential; + rfxencode_quantization_proc rfxencode_quantization; + rfxencode_dwt_2d_proc rfxencode_dwt_2d; + rfxencode_diff_rlgr1_proc rfxencode_diff_rlgr1; + rfxencode_diff_rlgr3_proc rfxencode_diff_rlgr3; + rfxencode_dwt_shift_x86_sse2_proc rfxencode_dwt_shift_x86_sse2; + rfxencode_dwt_shift_x86_sse41_proc rfxencode_dwt_shift_x86_sse41; + rfxencode_dwt_shift_amd64_sse2_proc rfxencode_dwt_shift_amd64_sse2; + rfxencode_dwt_shift_amd64_sse41_proc rfxencode_dwt_shift_amd64_sse41; +}; + +int +rfxcodec_encode_get_internals(struct rfxcodec_encode_internals *internals); + #endif diff --git a/src/rfxencode.c b/src/rfxencode.c index bd5d7b7..b163827 100644 --- a/src/rfxencode.c +++ b/src/rfxencode.c @@ -31,6 +31,13 @@ #include "rfxencode_compose.h" #include "rfxconstants.h" #include "rfxencode_tile.h" +#include "rfxencode_rlgr1.h" +#include "rfxencode_rlgr3.h" +#include "rfxencode_differential.h" +#include "rfxencode_quantization.h" +#include "rfxencode_dwt.h" +#include "rfxencode_diff_rlgr1.h" +#include "rfxencode_diff_rlgr3.h" #ifdef RFX_USE_ACCEL_X86 #include "x86/funcs_x86.h" @@ -344,3 +351,25 @@ rfxcodec_encode(void *handle, char *cdata, int *cdata_bytes, num_tiles, quants, num_quants, 0); } +/******************************************************************************/ +int +rfxcodec_encode_get_internals(struct rfxcodec_encode_internals *internals) +{ + memset(internals, 0, sizeof(struct rfxcodec_encode_internals)); + internals->rfxencode_rlgr1 = rfx_rlgr1_encode; + internals->rfxencode_rlgr3 = rfx_rlgr3_encode; + internals->rfxencode_differential = rfx_differential_encode; + internals->rfxencode_quantization = rfx_quantization_encode; + internals->rfxencode_dwt_2d = rfx_dwt_2d_encode; + internals->rfxencode_diff_rlgr1 = rfx_encode_diff_rlgr1; + internals->rfxencode_diff_rlgr3 = rfx_encode_diff_rlgr3; +#if defined(RFX_USE_ACCEL_X86) + internals->rfxencode_dwt_shift_x86_sse2 = rfxcodec_encode_dwt_shift_x86_sse2; + internals->rfxencode_dwt_shift_x86_sse41 = rfxcodec_encode_dwt_shift_x86_sse41; +#endif +#if defined(RFX_USE_ACCEL_AMD64) + internals->rfxencode_dwt_shift_amd64_sse2 = rfxcodec_encode_dwt_shift_amd64_sse2; + internals->rfxencode_dwt_shift_amd64_sse41 = rfxcodec_encode_dwt_shift_amd64_sse41; +#endif + return 0; +} -- cgit v1.2.3