diff options
Diffstat (limited to 'src/lib/util/avhuff.c')
-rw-r--r-- | src/lib/util/avhuff.c | 256 |
1 files changed, 191 insertions, 65 deletions
diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c index dd589c6abdd..cb00ab23336 100644 --- a/src/lib/util/avhuff.c +++ b/src/lib/util/avhuff.c @@ -143,7 +143,6 @@ inline void avhuff_encoder::deltarle_encoder::encode_one(bitstream_out &bitbuf, //------------------------------------------------- // decode_one - decode data //------------------------------------------------- - inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf) { // return RLE data if we still have some @@ -174,9 +173,13 @@ inline UINT32 avhuff_decoder::deltarle_decoder::decode_one(bitstream_in &bitbuf) // AVHUFF ENCODER //************************************************************************** -//------------------------------------------------- -// avhuff_encoder - constructor -//------------------------------------------------- +/** + * @fn avhuff_encoder::avhuff_encoder() + * + * @brief ------------------------------------------------- + * avhuff_encoder - constructor + * -------------------------------------------------. + */ avhuff_encoder::avhuff_encoder() { @@ -185,11 +188,19 @@ m_flac_encoder.set_num_channels(1); m_flac_encoder.set_strip_metadata(true); } - -//------------------------------------------------- -// encode_data - encode a block of data into a -// compressed data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_data - encode a block of data into a compressed data stream + * -------------------------------------------------. + * + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT32 &complength) { @@ -266,11 +277,17 @@ avhuff_error avhuff_encoder::encode_data(const UINT8 *source, UINT8 *dest, UINT3 return AVHERR_NONE; } - -//------------------------------------------------- -// raw_data_size - return the raw data size of -// a raw stream based on the header -//------------------------------------------------- +/** + * @fn UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) + * + * @brief ------------------------------------------------- + * raw_data_size - return the raw data size of a raw stream based on the header + * -------------------------------------------------. + * + * @param data The data. + * + * @return An UINT32. + */ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) { @@ -290,11 +307,23 @@ UINT32 avhuff_encoder::raw_data_size(const UINT8 *data) return size; } - -//------------------------------------------------- -// assemble_data - assemble a datastream from raw -// bits -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) + * + * @brief ------------------------------------------------- + * assemble_data - assemble a datastream from raw bits + * -------------------------------------------------. + * + * @param [in,out] buffer The buffer. + * @param [in,out] bitmap The bitmap. + * @param channels The channels. + * @param numsamples The numsamples. + * @param [in,out] samples If non-null, the samples. + * @param [in,out] metadata If non-null, the metadata. + * @param metadatasize The metadatasize. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 &bitmap, UINT8 channels, UINT32 numsamples, INT16 **samples, UINT8 *metadata, UINT32 metadatasize) { @@ -348,11 +377,21 @@ avhuff_error avhuff_encoder::assemble_data(dynamic_buffer &buffer, bitmap_yuy16 return AVHERR_NONE; } - -//------------------------------------------------- -// encode_audio - encode raw audio data to the -// destination -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) + * + * @brief ------------------------------------------------- + * encode_audio - encode raw audio data to the destination + * -------------------------------------------------. + * + * @param source Source for the. + * @param channels The channels. + * @param samples The samples. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] sizes If non-null, the sizes. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int samples, UINT8 *dest, UINT8 *sizes) { @@ -471,11 +510,21 @@ avhuff_error avhuff_encoder::encode_audio(const UINT8 *source, int channels, int return AVHERR_NONE; } - -//------------------------------------------------- -// encode_video - encode raw video data to the -// destination -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_video - encode raw video data to the destination + * -------------------------------------------------. + * + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) { @@ -483,11 +532,22 @@ avhuff_error avhuff_encoder::encode_video(const UINT8 *source, int width, int he return encode_video_lossless(source, width, height, dest, complength); } - -//------------------------------------------------- -// encode_video_lossless - do a lossless video -// encoding using deltas and huffman encoding -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) + * + * @brief ------------------------------------------------- + * encode_video_lossless - do a lossless video encoding using deltas and huffman + * encoding + * -------------------------------------------------. + * + * @param source Source for the. + * @param width The width. + * @param height The height. + * @param [in,out] dest If non-null, destination for the. + * @param [in,out] complength The complength. + * + * @return An avhuff_error. + */ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int width, int height, UINT8 *dest, UINT32 &complength) { @@ -540,10 +600,20 @@ avhuff_error avhuff_encoder::encode_video_lossless(const UINT8 *source, int widt // DELTA-RLE ENCODER //************************************************************************** -//------------------------------------------------- -// rle_and_histo_bitmap - RLE compress and -// histogram a bitmap's worth of data -//------------------------------------------------- +/** + * @fn UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) + * + * @brief ------------------------------------------------- + * rle_and_histo_bitmap - RLE compress and histogram a bitmap's worth of data + * -------------------------------------------------. + * + * @param source Source for the. + * @param items_per_row The items per row. + * @param item_advance The item advance. + * @param row_count Number of rows. + * + * @return null if it fails, else an UINT16*. + */ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *source, UINT32 items_per_row, UINT32 item_advance, UINT32 row_count) { @@ -608,18 +678,27 @@ UINT16 *avhuff_encoder::deltarle_encoder::rle_and_histo_bitmap(const UINT8 *sour // AVHUFF DECODER //************************************************************************** -//------------------------------------------------- -// avhuff_decoder - constructor -//------------------------------------------------- +/** + * @fn avhuff_decoder::avhuff_decoder() + * + * @brief ------------------------------------------------- + * avhuff_decoder - constructor + * -------------------------------------------------. + */ avhuff_decoder::avhuff_decoder() { } - -//------------------------------------------------- -// configure - configure decompression parameters -//------------------------------------------------- +/** + * @fn void avhuff_decoder::configure(const avhuff_decompress_config &config) + * + * @brief ------------------------------------------------- + * configure - configure decompression parameters + * -------------------------------------------------. + * + * @param config The configuration. + */ void avhuff_decoder::configure(const avhuff_decompress_config &config) { @@ -632,11 +711,19 @@ void avhuff_decoder::configure(const avhuff_decompress_config &config) m_config.metadata = config.metadata; } - -//------------------------------------------------- -// decode_data - decode both audio and video from -// a raw data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) + * + * @brief ------------------------------------------------- + * decode_data - decode both audio and video from a raw data stream + * -------------------------------------------------. + * + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, UINT8 *dest) { @@ -765,11 +852,25 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength, return AVHERR_NONE; } - -//------------------------------------------------- -// decode_audio - decode audio from a compressed -// data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) + * + * @brief ------------------------------------------------- + * decode_audio - decode audio from a compressed data stream + * -------------------------------------------------. + * + * @exception CHDERR_DECOMPRESSION_ERROR Thrown when a chderr decompression error error + * condition occurs. + * + * @param channels The channels. + * @param samples The samples. + * @param source Source for the. + * @param [in,out] dest If non-null, destination for the. + * @param dxor The dxor. + * @param sizes The sizes. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 *source, UINT8 **dest, UINT32 dxor, const UINT8 *sizes) { @@ -889,11 +990,23 @@ avhuff_error avhuff_decoder::decode_audio(int channels, int samples, const UINT8 return AVHERR_NONE; } - -//------------------------------------------------- -// decode_video - decode video from a compressed -// data stream -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * + * @brief ------------------------------------------------- + * decode_video - decode video from a compressed data stream + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) { @@ -904,11 +1017,24 @@ avhuff_error avhuff_decoder::decode_video(int width, int height, const UINT8 *so return AVHERR_INVALID_DATA; } - -//------------------------------------------------- -// decode_video_lossless - do a lossless video -// decoding using deltas and huffman encoding -//------------------------------------------------- +/** + * @fn avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) + * + * @brief ------------------------------------------------- + * decode_video_lossless - do a lossless video decoding using deltas and huffman + * encoding + * -------------------------------------------------. + * + * @param width The width. + * @param height The height. + * @param source Source for the. + * @param complength The complength. + * @param [in,out] dest If non-null, destination for the. + * @param dstride The dstride. + * @param dxor The dxor. + * + * @return An avhuff_error. + */ avhuff_error avhuff_decoder::decode_video_lossless(int width, int height, const UINT8 *source, UINT32 complength, UINT8 *dest, UINT32 dstride, UINT32 dxor) { |