Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly Class Reference
[mxcpc_core (Core Module - MxPEG Decoding Infrastructure)]

Framewise scan decoder converting an MxPEG stream to a sequence of JPEG images using no external hardware-optimized acceleration routines. More...

#include <mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h>

Inheritance diagram for mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly:

mxcpcFramewiseMxPEGScanToJPEGConverter mxcpcFramewiseMxPEGScanDecoder List of all members.

Public Member Functions

 mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly (mxcpcJPEGReceiver *receiver)
 The converter assumes ownership over the JPEG receiver.
 ~mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly ()
const char * getAccelerationTypeString (void)
 (Re)implemented.
void setYQuantizationTable (unsigned char *data_bytes)
 (Re)implemented.
void setUVQuantizationTable (unsigned char *data_bytes)
 (Re)implemented.
void performScanSweep (mxcpcFramewiseMxPEGDecoder::UndecodedFrameDescriptor *frame_descriptor)
 (Re)implemented.

Private Member Functions

void calcFoldedHuffTables (void)
 Calculate the huffman tables ..
void generateHuffTables1 (const mxcpc::u8 *bits_tbl_off1, const mxcpc::u8 *val_tbl, int swap_symbol, HuffCodeTblEntry *folded_tbl_p)
 Create a huffman lookup table.
void initHuffmanEncoderBufferState ()
 Init the Buffer.
void resetHuffmanEncoderBufferState ()
bool consumeScanBit (void)
 We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.
const mxcpcHuffmanTree::NodeconsumeHuffmanCodeword (const mxcpcHuffmanTree::Node *current_huffman_node)
 We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.
bool consumeAdditionalBits (int n)
 We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.
void encodeSubMCUTiles (mxcpc::s16 *coef_matrix, mxcpc::s16 *last_dc_coeff, FoldedHuffTbl_DC_AC *huff_code_tbl_entry, HuffmanBufferStateStructure *hbuf_state_ptr)
 This Method takes a 8x8 sub-MCU and preforms a swift Huffman Encoding.

Static Private Member Functions

static void copyAccuToGlobalHuffBuffer (mxcpc::u32 huff_accu_32, HuffmanBufferStateStructure *huff_buf_state_ptr)
 Copies a word into the global huffman encoding buffer!
static int shutDownHuffAccu (void)
 Closes down huffman encoding stream.
static int returnBitsInCoef (mxcpc::s16 c)
 Number of bits from ....

Private Attributes

mxcpc::u8HuffmanEncoderBuffer
 Pointer to Huffman encode buffer.
mxcpcHuffmanTreeHuffmanTree_Y_DC
mxcpcHuffmanTreeHuffmanTree_Y_AC
mxcpcHuffmanTreeHuffmanTree_UV_DC
mxcpcHuffmanTreeHuffmanTree_UV_AC
mxcpc::s16 QuantizationTable_Y [64]
mxcpc::s16 QuantizationTable_UV [64]
mxcpc::s16CoeffBuffer
 Ptr. to decoded frame!
int TileNumX
 Nb. of tiles to handle per frame!
int TileNumY
unsigned char * CurrentScanByte
unsigned char ScanMask
int ScanBytesLeft
int CoeffInAdditionalBits
mxcpc_mxpeg::APP0 APP0_Block
mxcpc_mxpeg::SOF0 SOF0_Block
mxcpc_mxpeg::SOS SOS_Block
int FramesProcessed

Static Private Attributes

static const unsigned char ZigZag_StoreMap [64]
static const int ZigZagMap [64]
static const HuffCompDC HuffTbl_Y_UV_DC [2]
static const HuffCompAC HuffTbl_Y_UV_AC [2]
static FoldedHuffTbl_DC_AC Huff_Y_UV [2]
 Array of two tables, size = 2*0xB0 words = 1408 bytes : */.
static HuffmanBufferStateStructure HuffmanBufferState
 Instance of HuffmanBufferStateStructure hold once!

Classes

struct  FoldedHuffTbl_DC_AC
struct  HuffCodeTblEntry
 Single entry in table. More...
struct  HuffCompAC
 One AC huffman table - rules for one component (Y or UV). More...
struct  HuffCompDC
 One DC huffman table - rules for one component (Y or UV). More...
struct  HuffmanBufferStateStructure
 This structure holds the buffer state for huffman encoding ... More...
union  u32t
 Used to convert a HuffCodeTblEntry -> mxcpc::u32 ! More...

Detailed Description

Framewise scan decoder converting an MxPEG stream to a sequence of JPEG images using no external hardware-optimized acceleration routines.

Does not really use the regular decoder backend, therefore install the mxcpcDefaultMxPEGDecoderBackEnd with your decoder

You can choose among various mxcpcJPEGReceiver s though, doing all sorts of stuff with your generated JPEG images.

Warning:
In its current version, this class is not threadable.
Author:
Gruys

Definition at line 58 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.


Member Function Documentation

void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::calcFoldedHuffTables void   )  [private]
 

Calculate the huffman tables ..

Calculates huffman tables a la mobotix!

Definition at line 698 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.cpp.

bool mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::consumeAdditionalBits int  n  )  [inline, private]
 

We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.

Specify as argument the number n >= 1 of additional bits to read.

The coefficient represented by the read bits will be stored to the class member variable CoeffInAdditionalBits.

The method internally checks for ScanBytesLeft > 0.

It returns false on success, and true if all scan bytes were cosumed before a valid codeword was detected.

Definition at line 311 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

References CoeffInAdditionalBits, consumeScanBit(), and ScanBytesLeft.

const mxcpcHuffmanTree ::Node* mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::consumeHuffmanCodeword const mxcpcHuffmanTree::Node current_huffman_node  )  [inline, private]
 

We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.

Specify as argument the root of the Huffman tree to be used for codeword recognition.

Internally checks for ScanBytesLeft > 0.

Returns the Huffman leaf node corresponding to the codeword just consumed or 0 in case of failure. Failure conditions can be

  • an invalid bitstring was encountered
  • all scan bytes were cosumed before a valid codeword was detected

Definition at line 269 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

References mxcpcHuffmanTree::Node::Child0, mxcpcHuffmanTree::Node::Child1, consumeScanBit(), mxcpcHuffmanTree::Node::IsLeaf, and ScanBytesLeft.

bool mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::consumeScanBit void   )  [inline, private]
 

We need this often in inner loops of performScanSweep(), so we request inline substitution and hope the compiler sufficiently rocks.

Only to be called if ScanBytesLeft > 0.

Returns whether or not the bit just consumed was set.

Definition at line 215 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

References CurrentScanByte, ScanBytesLeft, ScanMask, and mxcpc::sendStatusMsg().

Referenced by consumeAdditionalBits(), and consumeHuffmanCodeword().

static void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::copyAccuToGlobalHuffBuffer mxcpc::u32  huff_accu_32,
HuffmanBufferStateStructure huff_buf_state_ptr
[inline, static, private]
 

Copies a word into the global huffman encoding buffer!

Parameters:
huff_accu_32 Input word.
huff_buf_state_ptr Ptr. to global buffer.

Definition at line 589 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

References mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffmanBufferStateStructure::buf_current_w_pos, mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffmanBufferStateStructure::buf_end1, and mxcpc::sendStatusMsg().

Referenced by encodeSubMCUTiles().

void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::encodeSubMCUTiles mxcpc::s16 coef_matrix,
mxcpc::s16 last_dc_coeff,
FoldedHuffTbl_DC_AC huff_code_tbl_entry,
HuffmanBufferStateStructure hbuf_state_ptr
[inline, private]
 

This Method takes a 8x8 sub-MCU and preforms a swift Huffman Encoding.

Parameters:
coef_matrix The 8x8 input coefficient matrix!
last_dc_coeff Ptr to a list of the last DC coefficients.
huff_code_tbl_entry A huffman table.
hbuf_state_ptr Ptr to global buffer state.

Definition at line 363 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

References mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCodeTblEntry::bit_len, mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCodeTblEntry::code_msk, copyAccuToGlobalHuffBuffer(), mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffmanBufferStateStructure::huf_accu, mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffmanBufferStateStructure::huf_bits_used, returnBitsInCoef(), mxcpc::sendStatusMsg(), mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::u32t::table_entry, and ZigZagMap.

void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::generateHuffTables1 const mxcpc::u8 bits_tbl_off1,
const mxcpc::u8 val_tbl,
int  swap_symbol,
HuffCodeTblEntry folded_tbl_p
[private]
 

Create a huffman lookup table.

Parameters:
bits_tbl_off1 Entries 0..15 count no. of symbols with 1..16 bits, respectively.
val_tbl Table of symbols that need to be encoded, size = sum of entries in bits_tbl_off1.
swap_symbol Set if the swapped symbol is used to access the generated folded table (for ac-coefs).
folded_tbl_p Holds the generated huffman tables!

Definition at line 759 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.cpp.

References mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCodeTblEntry::bit_len, mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCodeTblEntry::code_msk, and mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCodeTblEntry::fill_0bit.

void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::initHuffmanEncoderBufferState  )  [private]
 

Init the Buffer.

Take care of initialisierung!

Definition at line 798 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.cpp.

void mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::resetHuffmanEncoderBufferState  )  [private]
 

Reset HuffmanEncoderBufferState in order to fetch next frame!

Definition at line 816 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.cpp.

static int mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::returnBitsInCoef mxcpc::s16  c  )  [inline, static, private]
 

Number of bits from ....

Parameters:
c <- this!

Definition at line 661 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

Referenced by encodeSubMCUTiles().


Member Data Documentation

const mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffCompDC mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::HuffTbl_Y_UV_DC [static, private]
 

Initial value:

{
  { 
    { 0, 1, 5, 1, 1, 1, 1, 1, 1, 0,  0,  0, 0, 0, 0, 0 }, 
     
    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },                                           
        
  },
  { 
    { 0, 3, 1, 1, 1, 1, 1, 1, 1, 1,  1,  0, 0, 0, 0, 0 }, 
     
    { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
        
  }
}

Definition at line 86 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

const unsigned char mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::ZigZag_StoreMap [static, private]
 

Initial value:

 {
                                                  0,  1,  5,  6, 14, 15, 27, 28,
                                                  2,  4,  7, 13, 16, 26, 29, 42,
                                                  3,  8, 12, 17, 25, 30, 41, 43,
                                                  9, 11, 18, 24, 31, 40, 44, 53,
                                                 10, 19, 23, 32, 39, 45, 52, 54,
                                                 20, 22, 33, 38, 46, 51, 55, 60,
                                                 21, 34, 37, 47, 50, 56, 59, 61,
                                                 35, 36, 48, 49, 57, 58, 62, 63
                                             }

Definition at line 62 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

const int mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly::ZigZagMap [static, private]
 

Initial value:

 {  
                                                  0,  1,  8, 16,  9,  2,  3, 10, 
                                                 17, 24, 32, 25, 18, 11,  4,  5,
                                                 12, 19, 26, 33, 40, 48, 41, 34, 
                                                 27, 20, 13,  6,  7, 14, 21, 28,
                                                 35, 42, 49, 56, 57, 50, 43, 36,
                                                 29, 22, 15, 23, 30, 37, 44, 51, 
                                                 58, 59, 52, 45, 38, 31, 39, 46, 
                                                 53, 60, 61, 54, 47, 55, 62, 63 
                                                }

Definition at line 63 of file mxcpcFramewiseMxPEGScanToJPEGConverterSoftwareOnly.h.

Referenced by encodeSubMCUTiles().


The documentation for this class was generated from the following files:
Generated on Fri Jan 20 13:33:35 2006 for mxcpc by  doxygen 1.4.4