libavcodec/mlp.c File Reference

#include <stdint.h>
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "mlp.h"

Go to the source code of this file.

Defines

#define CRC_TABLE_SIZE   1024

Functions

av_cold void ff_mlp_init_crc (void)
uint16_t ff_mlp_checksum16 (const uint8_t *buf, unsigned int buf_size)
uint8_t ff_mlp_checksum8 (const uint8_t *buf, unsigned int buf_size)
 MLP uses checksums that seem to be based on the standard CRC algorithm, but are not (in implementation terms, the table lookup and XOR are reversed).
uint8_t ff_mlp_restart_checksum (const uint8_t *buf, unsigned int bit_size)
 Calculate an 8-bit checksum over a restart header -- a non-multiple-of-8 number of bits, starting two bits into the first byte of buf.
uint8_t ff_mlp_calculate_parity (const uint8_t *buf, unsigned int buf_size)
 XOR together all the bytes of a buffer.

Variables

const uint8_t ff_mlp_huffman_tables [3][18][2]
 Tables defining the Huffman codes.
static int crc_init = 0
static AVCRC crc_63 [CRC_TABLE_SIZE]
static AVCRC crc_1D [CRC_TABLE_SIZE]
static AVCRC crc_2D [CRC_TABLE_SIZE]


Define Documentation

#define CRC_TABLE_SIZE   1024

Definition at line 48 of file mlp.c.


Function Documentation

uint8_t ff_mlp_calculate_parity ( const uint8_t *  buf,
unsigned int  buf_size 
)

XOR together all the bytes of a buffer.

Does this belong in dspcontext?

Definition at line 99 of file mlp.c.

Referenced by read_access_unit().

uint16_t ff_mlp_checksum16 ( const uint8_t *  buf,
unsigned int  buf_size 
)

Definition at line 64 of file mlp.c.

Referenced by ff_mlp_read_major_sync().

uint8_t ff_mlp_checksum8 ( const uint8_t *  buf,
unsigned int  buf_size 
)

MLP uses checksums that seem to be based on the standard CRC algorithm, but are not (in implementation terms, the table lookup and XOR are reversed).

We can implement this behavior using a standard av_crc on all but the last element, then XOR that with the last element.

Definition at line 73 of file mlp.c.

Referenced by read_access_unit().

av_cold void ff_mlp_init_crc ( void   ) 

Definition at line 54 of file mlp.c.

Referenced by init_static(), and mlp_init().

uint8_t ff_mlp_restart_checksum ( const uint8_t *  buf,
unsigned int  bit_size 
)

Calculate an 8-bit checksum over a restart header -- a non-multiple-of-8 number of bits, starting two bits into the first byte of buf.

Definition at line 80 of file mlp.c.

Referenced by read_restart_header().


Variable Documentation

AVCRC crc_1D[CRC_TABLE_SIZE] [static]

Definition at line 51 of file mlp.c.

Referenced by ff_mlp_init_crc(), and ff_mlp_restart_checksum().

AVCRC crc_2D[CRC_TABLE_SIZE] [static]

Definition at line 52 of file mlp.c.

Referenced by ff_mlp_checksum16(), and ff_mlp_init_crc().

AVCRC crc_63[CRC_TABLE_SIZE] [static]

Definition at line 50 of file mlp.c.

Referenced by ff_mlp_checksum8(), and ff_mlp_init_crc().

int crc_init = 0 [static]

Definition at line 44 of file mlp.c.

Referenced by ff_mlp_init_crc().

const uint8_t ff_mlp_huffman_tables[3][18][2]

Initial value:

 {
    {    
        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
        {0x04, 3}, {0x05, 3}, {0x06, 3}, {0x07, 3},
        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
    }, { 
        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
        {0x02, 2}, {0x03, 2},
        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
    }, { 
        {0x01, 9}, {0x01, 8}, {0x01, 7}, {0x01, 6}, {0x01, 5}, {0x01, 4}, {0x01, 3},
        {0x01, 1},
        {0x03, 3}, {0x05, 4}, {0x09, 5}, {0x11, 6}, {0x21, 7}, {0x41, 8}, {0x81, 9},
    }
}
Tables defining the Huffman codes.

There are three entropy coding methods used in MLP (four if you count "none" as a method). These use the same sequences for codes starting with 00 or 01, but have different codes starting with 1.

Definition at line 28 of file mlp.c.

Referenced by init_static().


Generated on Fri Oct 26 02:46:09 2012 for FFmpeg by  doxygen 1.5.8