RLE Module

doublebuffer module

The above module is a double buffer to store runlength encoded data

jpegenc.subblocks.rle.doublebuffer.doublefifo

I/O ports:

dfifo_bus : A FIFOBus connection interace buffer_sel : select a buffer

Constants :

depth : depth of the fifo used width_data : width of the data to be stored in FIFO

entropycoder module

This module takes a input and returns amplitude of the input and number of bits required to store the input.

jpegenc.subblocks.rle.entropycoder.bit_length(num, maxlen=32)

Determine the number of bits required to represent a value This functions provides the same functionality as the Python int.bit_length() function but is convertible.

This function generates the combinatorial logic to determine the maximum number of bits required to represent an unsigned value.

Currently the function computes a maximum of maxlen bits.

for values larger than 2**maxlen this function will fail. myhdl convertible

jpegenc.subblocks.rle.entropycoder.entropy_encode(amplitude)

Model of the entropy encoding

Arguments:
amplitude (int): given an integer generate the encoding
Returns:
amplitude_ref: size_ref:
jpegenc.subblocks.rle.entropycoder.entropycoder

This module return the amplitude and number of bits required to store input

io ports:

data_in : input data into the entropy coder

size : number of bits required to store amplitude amplitude : amplitude of the input

constants:

width_data : width of the input data

jpegenc.subblocks.rle.entropycoder.two2bin(num)

converts negative number to positive

rle module

This module is the MyHDL implementation of run length encoder top module

class jpegenc.subblocks.rle.rle.BufferDataBus(width_data, width_size, width_runlength)

Bases: jpegenc.subblocks.rle.rlecore.RLESymbols

Connections related to output data buffer

Amplitude : amplitude of the number size : size required to store amplitude runlength : number of zeros dovalid : asserts if ouput data is valid buffer_sel : select the buffer in double buffer read_enable : read data from the output fifo fifo_empty : asserts if any of the two fifos are empty

jpegenc.subblocks.rle.rle.rlencoder

The top module connects rle core and rle double buffer

I/O Ports:

datastream : input datastream bus buffer data bus : output data bus rleconfig : configuration bus

Constants:

width_data : input data width width_addr : address width width_size : width of register to store amplitude size max_addr_cnt : maximum address of the block being processed width_runlength : width of runlength value that can be stored limit : value of maximum runlength value width_depth : width of the FIFO Bus

rlecore module

This module if the core of the run length encoder module

class jpegenc.subblocks.rle.rlecore.Component

Bases: object

Select the color component

class jpegenc.subblocks.rle.rlecore.DataStream(width_data=12, width_addr=6)

Bases: object

Input data streams into Rle Core

data_in : input to the rle module read_addr : address of input data from the input ram

class jpegenc.subblocks.rle.rlecore.RLEConfig

Bases: object

RLE configuration Signals are the generic signals used in the block

color_component : select the color component
to be processed(Y1, Y2, Cb or Cr)

start : start signal triggers the module to start processing data sof : start of frame asserts when next frame is ready

class jpegenc.subblocks.rle.rlecore.RLESymbols(width_data=12, width_size=6, width_runlength=4)

Bases: object

Output symbols generatred by RLE Core

Amplitude : amplitude of the number size : size required to store amplitude runlength : number of zeros dovalid : asserts if ouput is valid

jpegenc.subblocks.rle.rlecore.rle

This is the RLE Core module

IO Ports:

datastream : input data and address to the input bus rlesymbols : output generated by core module rleconfig : configuration ports for rle core

constants:

width_data : input data width width_addr : address width width_size : width of register to store amplitude max_addr_cnt : maximum address of the block being processed width_runlength : width of runlength value that can be stored limit : value of maximum runlength value

jpegenc.subblocks.rle.rlecore.sub(num1, num2)

subtractor for Difference Encoder