namespace codec

// namespaces

namespace xf::codec::details

// typedefs

typedef int16_t idct_in_t
typedef uint8_t idct_out_t

// enums

enum COLOR_FORMAT

// structs

struct bas_info
struct cmp_info
struct img_info

pikEncKernel1Top

#include "pikEnc/XAccPIKKernel1.hpp"
void pikEncKernel1Top (
    ap_uint <32> config [(32)],
    ap_uint < ( (32)*2)> rbuf [((8192 *8192)*3)/2],
    ap_uint <32> axi_out [(3 *(((1024)+4-1)/4)*(((1024)+4-1)/4)*32 *32)],
    ap_uint <32> axi_cmap [(((1024)*(1024))/64 *2+2)],
    ap_uint <32> axi_qf [(((1024)*(1024))+2)]
    )

Level 2 : kernel1 implement for pik.

Parameters:

config control signals, such as image size information, stream length and offsets of each colors.
rbuf the input RGB data, alligned by different colors.
axi_out the output of XYB data generated by color transformation of RGB.
axi_cmap color correlation map, for adjust color in AC quantization.
axi_qf information of the quant-field, for choosing correct quant-table in AC quantization.

pikEncKernel2Top

#include "pikEnc/XAccPIKKernel2.hpp"
void pikEncKernel2Top (
    ap_uint < (32)> config [(32)],
    ap_uint <2* (32)> src [(3 *(((1024)+4-1)/4)*(((1024)+4-1)/4)*32 *32)/2],
    ap_uint < (32)> quant_field_in [(((1024)*(1024))+2)],
    ap_uint < (32)> cmap [(((1024)*(1024))/64 *2+2)],
    ap_uint < (32)> ac [(3 *(((1024)+4-1)/4)*(((1024)+4-1)/4)*32 *32)],
    ap_uint < (32)> dc [(((1024)*(1024))*3)],
    ap_uint < (32)> quant_field_out [(((1024)*(1024))+2)],
    ap_uint < (32)> ac_strategy [((1024)*(1024))],
    ap_uint < (32)> block [((1024)*(1024))],
    ap_uint < (32)> order [(((1024)+64-1)/64)*(((1024)+64-1)/64)*3 *64]
    )

Level 2 : kernel2 implement for pik.

Parameters:

config control signals, such as image size information, stream length and offsets of each colors.
src the input XYB data, alligned by different colors and stored in 32x32 of rectangular block order.
quant_field_in information of the floating point quant-field, for choosing correct quant-table in AC quantization.
cmap color correlation map, for adjust color in AC quantization.
ac output quantized AC stream.
dc output quantized DC stream.
quant_field_out output information of quantized quant-field, it indicate the correct quant-table for decoder.
ac_strategy output AC strategy is the information about DCT size of each 8x8 block in image.
block output block show the beginning position of each DCT computation.
order output information of order is used for zigzag encoding in kernel3.

pikEncKernel3Top

#include "pikEnc/XAccPIKKernel3.hpp"
void pikEncKernel3Top (
    ap_uint <32>* config,
    ap_uint <32>* ddr_ac,
    ap_uint <32>* ddr_dc,
    ap_uint <32>* ddr_quant_field,
    ap_uint <32>* ddr_ac_strategy,
    ap_uint <32>* ddr_block,
    ap_uint <32>* hls_order,
    ap_uint <32>* histo_cfg,
    ap_uint <32>* dc_histo_code_out,
    ap_uint <32>* dc_code_out,
    ap_uint <32>* ac_histo_code_out,
    ap_uint <32>* ac_code_out
    )

Level 2 : kernel3 implement for pik.

Parameters:

config control signals, such as image size information, stream length and offsets of each colors.
ddr_ac input quantized AC stream.
ddr_dc input quantized DC stream.
ddr_quant_field input of quant-table information for decoder
ddr_ac_strategy input information of DCT size of each small block8x8.
ddr_block input information of DCT starting position.
hls_order input information of encoding order.
histo_cfg output config for AC and DC histo lengths.
dc_histo_code_out encoding result of DC histo.
dc_code_out encoding result of DC token.
ac_histo_code_out the encoding result of AC histo.
ac_code_out encoding result of AC token.

kernelJpegDecoderTop

#include "jpegDec/XAcc_idct.hpp"
void kernelJpegDecoderTop (
    ap_uint < (16)>* jpeg_pointer,
    const int size,
    ap_uint <64>* yuv_mcu_pointer,
    ap_uint <32>* infos
    )

Level 2 : kernel implement for jfif parser + huffman decoder + iQ_iDCT.

Parameters:

CH_W size of data path in dataflow region, in bit. when CH_W is 16, the decoder could decode one symbol per cycle in about 99% cases. when CH_W is 8 , the decoder could decode one symbol per cycle in about 80% cases, but use less resource.
jpeg_pointer the input jpeg to be read from DDR.
size the total bytes to be read from DDR.
yuv_mcu_pointer the output yuv to DDR in mcu order.
info information of the image, maybe use in the recovery image.

resizeTop

#include "resize/bicubicinterpolator.hpp"
void resizeTop (
    ap_uint <32>* configs,
    ap_uint <WDATA>* axi_src,
    ap_uint <WDATA>* axi_dst
    )

Resize scales the image from bigger to smaller based bicubic interpolation algorithm and it takes advantage of uram storage features to implement 8-pixels/clock.

Parameters:

configs the stored parameters representing src_width, src_height, dst_width, dst_height.
axi_src the hbm memory for input
axi_dst the hbm memory for output

webp_IntraPredLoop2_NoOut_1

#include "webpEnc/vp8_hls_syn.h"
void webp_IntraPredLoop2_NoOut_1 (
    int32_t* p_info,
    uint32_t* ysrc,
    uint32_t* usrc,
    uint32_t* vsrc,
    int32_t* pout_level,
    uint8_t* pout_prob
    )

Level 2 : kernel for WebP intra prediction.

Parameters:

p_info basic information of image and compression parameters. More details can be found in function kernel_IntraPredLoop2_NoOut_core.
ysrc the Y sample of image as input.
usrc the U sample of image as input.
vsrc the V sample of image as input.
pout_level point to structures contains coefficients from a MB for output.
pout_prob probability table for output.

webp_2_ArithmeticCoding_1

#include "webpEnc/vp8_hls_syn.h"
void webp_2_ArithmeticCoding_1 (
    uint32_t pin_level [((((4096)+15)/16)*(((4096)+15)/16)*384/(4)/(4))],
    uint32_t pin_prob [2048/4],
    uint32_t pout_bw [((((4096)+15)/16)*(((4096)+15)/16)*384/(4)/(4))],
    uint32_t pout_ret [((((4096)+15)/16)*(((4096)+15)/16)*1/(4))],
    uint32_t pout_pred [((((4096)+15)/16)*(((4096)+15)/16)*8/(4))]
    )

Level 2 : kernel for WebP arithmetic coding.

Parameters:

pin_level point to structures contains coefficients from a MB as an input.
pin_prob probability table as an input.
pout_bw byte-stream created by arithmetic coding
pout_ret output stream in which the element indicates the non-zero status of 6 blocks of a MB
pout_pred output stream of prediction mode of Y.

jpegDecLeptonEnc

#include "leptonEnc/lepton/jpeg_dec_lepton_enc.hpp"
void jpegDecLeptonEnc (
    ap_uint < (16)>* datainDDR,
    int jpgSize,
    int* arithInfo,
    ap_uint <8>* res
    )

IMGAE Jpeg Decoder Lepton Encoder internal kernel.

For detailed document, see JpegD_LeptonE_kernel_design.

Parameters:

datainDDR input image buffer.
jpgSize size of input image buffer.
arithInfo meta information of output buffer.
res output lepton format data buffer.

JxlEnc_ans_clusterHistogram

#include "jxlEnc/hls_cluster_histogram.hpp"
void JxlEnc_ans_clusterHistogram (
    uint32_t* config,
    int32_t* histograms0_ptr,
    uint32_t* histo_totalcnt0_ptr,
    uint32_t* histo_size0_ptr,
    uint32_t* nonempty_histo0_ptr,
    uint8_t* ctx_map0_ptr,
    int32_t* histograms_clusd0_ptr,
    uint32_t* histo_size_clusd0_ptr,
    int32_t* histograms_clusdin0_ptr,
    int32_t* histograms1_ptr,
    uint32_t* histo_totalcnt1_ptr,
    uint32_t* histo_size1_ptr,
    uint32_t* nonempty_histo1_ptr,
    uint8_t* ctx_map1_ptr,
    int32_t* histograms_clusd1_ptr,
    uint32_t* histo_size_clusd1_ptr,
    int32_t* histograms_clusdin1_ptr,
    int32_t* histograms2_ptr,
    uint32_t* histo_totalcnt2_ptr,
    uint32_t* histo_size2_ptr,
    uint32_t* nonempty_histo2_ptr,
    uint8_t* ctx_map2_ptr,
    int32_t* histograms_clusd2_ptr,
    uint32_t* histo_size_clusd2_ptr,
    int32_t* histograms_clusdin2_ptr,
    int32_t* histograms3_ptr,
    uint32_t* histo_totalcnt3_ptr,
    uint32_t* histo_size3_ptr,
    uint32_t* nonempty_histo3_ptr,
    uint8_t* ctx_map3_ptr,
    int32_t* histograms_clusd3_ptr,
    uint32_t* histo_size_clusd3_ptr,
    int32_t* histograms_clusdin3_ptr,
    int32_t* histograms4_ptr,
    uint32_t* histo_totalcnt4_ptr,
    uint32_t* histo_size4_ptr,
    uint32_t* nonempty_histo4_ptr,
    uint8_t* ctx_map4_ptr,
    int32_t* histograms_clusd4_ptr,
    uint32_t* histo_size_clusd4_ptr,
    int32_t* histograms_clusdin4_ptr
    )

JXL ANS cluster Histogram kernel.

Parameters:

config configuration for the kernel.
histograms0_ptr histograms for Block Context Map.
histo_totalcnt0_ptr Count of context for histograms for Block Context Map.
histo_size0_ptr size for each context
nonempty_histo0_ptr indicate which context is empty
ctx_map0_ptr the input context map
histograms_clusd0_ptr the clustered histogram
histograms_clusdin0_ptr the context for the clustered histogram
histograms1_ptr histograms for Modular frame tree.
histo_totalcnt1_ptr Count of context for histograms for Modular frame tree.
histo_size1_ptr size for each context
nonempty_histo1_ptr indicate which context is empty
ctx_map1_ptr the input context map
histograms_clusd1_ptr the clustered histogram
histograms_clusdin1_ptr the context for the clustered histogram
histograms2_ptr histograms for code from Modular frame.
histo_totalcnt2_ptr Count of context for histograms for Modular frame.
histo_size2_ptr size for each context
nonempty_histo2_ptr indicate which context is empty
ctx_map2_ptr the input context map
histograms_clusd2_ptr the clustered histogram
histograms_clusdin2_ptr the context for the clustered histogram
histograms3_ptr histograms for coef orders.
histo_totalcnt3_ptr Count of context for histograms for coef orders.
histo_size3_ptr size for each context
nonempty_histo3_ptr indicate which context is empty
ctx_map3_ptr the input context map
histograms_clusd3_ptr the clustered histogram
histograms_clusdin3_ptr the context for the clustered histogram
histograms4_ptr histograms for ac coefficients.
histo_totalcnt4_ptr Count of context for histograms for ac coefficients.
histo_size4_ptr size for each context
nonempty_histo4_ptr indicate which context is empty
ctx_map4_ptr the input context map
histograms_clusd4_ptr the clustered histogram
histograms_clusdin4_ptr the context for the clustered histogram

JxlEnc_ans_initHistogram

#include "jxlEnc/hls_init_histogram.hpp"
void JxlEnc_ans_initHistogram (
    int config [32],
    int32_t ac_coeff_ordered_ddr [ALL_PIXEL],
    int32_t strategy_ddr [MAX_NUM_BLK88],
    int32_t qf_ddr [MAX_NUM_BLK88],
    uint8_t qdc_ddr [MAX_NUM_BLK88],
    uint8_t ctx_map [MAX_QF_THRESH_SIZE],
    uint32_t qf_thresholds [MAX_CTX_MAP_SIZE],
    uint64_t ac_tokens_ddr [MAX_AC_TOKEN_SIZE],
    ap_uint <64>* tokens0_ptr,
    ap_uint <64>* tokens1_ptr,
    ap_uint <64>* tokens2_ptr,
    ap_uint <64>* tokens3_ptr,
    int32_t* histograms0_ptr,
    uint32_t* histograms_size0_ptr,
    uint32_t* total_count0_ptr,
    uint32_t* nonempty0_ptr,
    int32_t* histograms1_ptr,
    uint32_t* histograms_size1_ptr,
    uint32_t* total_count1_ptr,
    uint32_t* nonempty1_ptr,
    int32_t* histograms2_ptr,
    uint32_t* histograms_size2_ptr,
    uint32_t* total_count2_ptr,
    uint32_t* nonempty2_ptr,
    int32_t* histograms3_ptr,
    uint32_t* histograms_size3_ptr,
    uint32_t* total_count3_ptr,
    uint32_t* nonempty3_ptr,
    int32_t* histograms4_ptr,
    uint32_t* histograms_size4_ptr,
    uint32_t* total_count4_ptr,
    uint32_t* nonempty4_ptr
    )

JXL ANS init Histogram kernel.

Parameters:

config configuration for the kernel.
ac_coef_ordered_ddr ac coefficients
strategy_ddr ac strategy
qf_ddr quant field
qdc_ddr qdc
ctx_map ctx_map ddr
qf_thresholds quantfield_thresholds
ac_tokens_ddr the ouput of ac tokens
token0_ptr tokens for Block Context Map
token1_ptr tokens for Modular frame tree
token2_ptr tokens for coef orders
token3_ptr tokens for Modular frames
histograms0_ptr histograms for Block Context Map.
histo_totalcnt0_ptr Count of context for histograms for Block Context Map.
histo_size0_ptr size for each context
nonempty_histo0_ptr indicate which context is empty
histograms1_ptr histograms for Modular frame tree.
histo_totalcnt1_ptr Count of context for histograms for Modular frame tree.
histo_size1_ptr size for each context
nonempty_histo1_ptr indicate which context is empty
histograms2_ptr histograms for code from Modular frame.
histo_totalcnt2_ptr Count of context for histograms for Modular frame.
histo_size2_ptr size for each context
nonempty_histo2_ptr indicate which context is empty
histograms3_ptr histograms for coef orders.
histo_totalcnt3_ptr Count of context for histograms for coef orders.
histo_size3_ptr size for each context
nonempty_histo3_ptr indicate which context is empty
histograms4_ptr histograms for ac coefficients.
histo_totalcnt4_ptr Count of context for histograms for ac coefficients.
histo_size4_ptr size for each context
nonempty_histo4_ptr indicate which context is empty

JxlEnc_lossy_enc_compute

#include "jxlEnc/hls_lossy_enc_compute.hpp"
void JxlEnc_lossy_enc_compute (
    int config [MAX_NUM_CONFIG],
    float config_fl [MAX_NUM_CONFIG],
    float* hls_opsin_1,
    float* hls_opsin_2,
    float* hls_opsin_3,
    float* quant_field_row,
    float* masking_field_row,
    float* aq_map_f,
    int8_t* cmap_axi,
    int* ac_coef_axiout,
    uint8_t* strategy_all,
    int* raw_quant_field_i,
    uint32_t* hls_order,
    float* hls_dc8x8,
    float* hls_dc16x16,
    float* hls_dc32x32
    )

Level 2 : kernel implement for JXL lossy frame encode computing.

Parameters:

config the int config signal, such as image size, field stride and etc.
config_fl the floating config signal, such as cost, inv_global_scale and etc.
hls_opsin_1 the input RGB image data for channnel-1.
hls_opsin_2 the input RGB image data for channnel-2.
hls_opsin_3 the input RGB image data for channnel-3.
quant_field_row the initial quant_filed data.
masking_filed_row the initial masking_filed data.
aq_map_f the initial adjust quant map data.
cmap_axi the output of color correlation map.
ac_coef_axiout the output of quanted AC coefficients.
strategy_all the output of strategy for each block in image
raw_quant_field_i the output of computed raw_quant_field
hls_order the output of orders for each block in image
hls_dc8x8 the DC coefficients output for 8x8 blocks
hls_dc16x16 the DC coefficients output for 16x16 blocks
hls_dc32x32 the DC coefficients output for 32x32 blocks