📄 ac_vld_decode_h.h
字号:
/* subtracting from 56. t02_ofs will be from 0...55. t35_ofs will *//* also be from 0..56 for the table entries from 56..112. Similar *//* properties hold for t68 and t9x offsets. *//* *//* p) run_val,size_val and len_cw are all loaded together using the same *//* offset that was figured in step (o) *//* *//* q) len_val is the length of the extra bits and is len_cw - size_val. *//* *//* r) The code bits of the base Huffman code word are shifted away and *//* the extra bits alone are retained in temp_ac. *//* *//* s) Neg_AC: Sign of the level and is 1 for positive and 0 for negative *//* numbers in conformance with JPEG. Neg_AC is the complement of the *//* sign of level_val. *//* *//* Neg_AC = 1 + ((signed)temp_ac >> 31); *//* *//* Neg_AC is 0 for positive level values and 1 for negative level *//* values. *//* *//* t) level_val = SHR(temp_ac,(32-size_val))-(Neg_AC<<size_val)+Neg_AC; *//* *//* level_val: shift right temp_ac after determining sign to get base *//* magnitude. If Neg_ac is 1 then remove this bit from Bit(sizeval) *//* by subtracting. Add 1 to the result. If Neg_ac is zero then the *//* magnitude reamins as such. *//* e.g. *//* levelval of -3 is coded as 01 with size-bits = 2 *//* This would be decoded as 01 -10 + 1 = 11 *//* levelval 0f 3 is code as 11 with size-bits = 2 *//* This would be decoded as 11 - 00 + 0 = 01 *//* *//* u) Store away run, level values and incr run, level pointers by 2 *//* *//* v) Increment num_coeffs (K) by run + 1 *//* *//* w) Deduct off the length of the codeword from bit_pos. Also advance *//* the data_stream by len_cw bits just parsed. *//* *//* x) Determine the complete number of bytes that can be inserted and *//* store in num_bytes_insert_val:(32-bit_pos_val)>>3 *//* For eg: if present bit_pos_val after step (w) is 9 then 2 complete *//* bytes and 7 bits of the 3rd byte can be insertes. These 7 bytes *//* constitute the overlap between data_word_val and dat_ptr. *//* *//* num_bytes_insert_val: This variable is used to increment *//* data_pointer. Start reading from this location on the next *//* iteration. This is also used to increment used_bytes_val *//* *//* y) The next set of bytes is being brought in as a 40 bit buffer in *//* temp word. To append this variable after bit_pos bits from the *//* left one needs to shift 8 + bit_pos_val *//* *//* z) Increment bit_pos_val by the number of bits in the complete byte *//* inserted. For eg. bit_pos = 9 and 2 bytes are inserted then it *//* will be incremented by 16 bits to become 25 *//* *//* Iterate steps k through z while EOB == 0 *//* *//* Steps to be performed after the loop *//* *//* a) *num_of_rles = numberval - 1. The number of run-level pairs found *//* is numberval - 1. Remember numberval is 1 more because it *//* increments for EOB as well. *//* *//* b) *bit_pos_vld = bit_pos_val; *//* Store off the current bit position in the pointer. Status variable *//* used for chaining VLD's. *//* *//* c) *used_up_bytes= used_bytes_val; *//* Store off the number of used up bytes in the pointer. Status *//* variable for chaining VLD's *//* *//* d) *data_word = data_word_val; *//* Store off the present VLD status word to begin resuming this on *//* next pass of the VLD. Status word of the VLD is the most important *//* state variable. *//* *//* e) *data_ptr = data_pointer; *//* Store off the pointer from which the next set of 5 bytes need *//* to be fetched at the end of the VLD. State variable used for *//* chaining VLD calls. *//* *//* DIAGNOSTICS *//* Return value == 1: Incorrect VLD stream in which K > 63 *//* Return value == 0: Correct VLD and valid JPEG stream *//* *//* CYCLES *//* 14 * N + 27 *//* where N is the number of symbols in a block *//* *//* Example: N=15 symbols/block: 237 cycles *//* *//* CODESIZE *//* 484 bytes *//* *//* BIBLIOGRAPHY *//* 1) JPEG still image data compression standard by William B *//* Pennabaker and Joan L. Mitchell *//* 2) CCITT T.81 standard *//* *//* ------------------------------------------------------------------------ *//* Copyright (c) 2002 Texas Instruments, Incorporated. *//* All Rights Reserved. *//* ======================================================================== */#ifndef AC_VLD_DECODE_H_H_#define AC_VLD_DECODE_H_H_ 1#ifndef AC_TBL_STRUCT_#define AC_TBL_STRUCT_ 1typedef struct AC_TBL_str{ unsigned char eob_flag; const unsigned char *run_ptr; const unsigned char *sze_ptr; const unsigned char *shf_ptr;} AC_TBL_str;#endifunsigned char ac_vld_decode_asm( const unsigned char **data_ptr, unsigned int *data_word, short *run_level, unsigned char *num_of_rles, unsigned char *bit_position, unsigned int *used_up_bytes, const AC_TBL_str *ac_table);#endif/* ======================================================================== *//* End of file: ac_vld_decode_h.h *//* ------------------------------------------------------------------------ *//* Copyright (c) 2002 Texas Instruments, Incorporated. *//* All Rights Reserved. *//* ======================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -