[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

US9608671B2 - Error detection method of variable-length coding code stream and decoding and error detection apparatus - Google Patents

Error detection method of variable-length coding code stream and decoding and error detection apparatus Download PDF

Info

Publication number
US9608671B2
US9608671B2 US14/265,346 US201414265346A US9608671B2 US 9608671 B2 US9608671 B2 US 9608671B2 US 201414265346 A US201414265346 A US 201414265346A US 9608671 B2 US9608671 B2 US 9608671B2
Authority
US
United States
Prior art keywords
bit number
data
data frame
range
decoded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active, expires
Application number
US14/265,346
Other versions
US20140337692A1 (en
Inventor
Jingjian Yu
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
AutoChips Inc
Original Assignee
AutoChips Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by AutoChips Inc filed Critical AutoChips Inc
Assigned to AUTOCHIPS INC. reassignment AUTOCHIPS INC. ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: YU, JINGJIAN
Publication of US20140337692A1 publication Critical patent/US20140337692A1/en
Application granted granted Critical
Publication of US9608671B2 publication Critical patent/US9608671B2/en
Active legal-status Critical Current
Adjusted expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/63Joint error correction and other techniques
    • H03M13/6312Error control coding in combination with data compression
    • H03M13/6318Error control coding in combination with data compression using variable length codes
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/63Joint error correction and other techniques
    • H03M13/6312Error control coding in combination with data compression
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/46Conversion to or from run-length codes, i.e. by representing the number of consecutive digits, or groups of digits, of the same kind by a code word and a digit indicative of that kind
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/60General implementation details not specific to a particular type of compression
    • H03M7/6041Compression optimized for errors

Definitions

  • the disclosed embodiments of the present invention relate to audio signal processing, and more particularly, to an error detection method of a variable-length coding code stream and a related decoding and error detection apparatus.
  • VLC Variable-Length Coding
  • the Variable-Length Coding is a coding method which performs coding upon data by using codewords with various lengths. Specifically speaking, the VLC employs shorter codewords to encode data with higher occurrence probability, and employs longer codewords to encode data with lower occurrence probability. The overall encoding efficiency is improved accordingly. Since lengths of the codewords employed by the VLC are not fixed, the exact data amount required to be decoded is unknown before the decoding process is completed. Conventionally, decoding a data frame may need to look up a coding table based on a codeword, thereby restoring an initial value corresponding to the codeword.
  • the coding table information, such as length range of a codeword and the correspondence between the codeword and the initial value, can be obtained.
  • the data amount read by the decoder may be affected, resulting in that the decoded code stream differs from the original code stream.
  • the VLC includes Huffman coding, Shannon-Fano algorithm, Exponential-Golomb coding, etc.
  • Huffman coding For example, suppose the intraframe source symbols of the original code stream required to be transmitted are a1, a5, a7, a1, a3 and a4, the original code stream 10, 010, 0111, 10, 000 and 001 can be derived by encoding the source symbols according to the correspondence between the source symbols and the codewords in a Huffman coding table (Table 1).
  • the receiving end when decoding the received code stream, the receiving end firstly reads the codeword “10” and derives a corresponding decoded source symbol as a1. Then the receiving end reads the codeword “011”, while no corresponding source symbol can be found in Table 1. Therefore, the receiving end will falsely employ the following bit “0” as part of the present codeword (i.e. the read codeword will be “0110”), and derive a corresponding decoded source symbol as a6. The decoding process continues by sequentially reading the code stream.
  • the derived source symbols are a1, a6, a2, a2, a3 and a3 respectively, while the last bit of the received code stream “1” is unused.
  • Said scenario is an example of how an erroneous decoding takes place, that is, the amount of used (read) data is less than it should be.
  • the decoded code stream mismatches the original code stream.
  • the source symbols corresponding to the first 5 codewords are a1, a6, a7, a3 and a3, respectively.
  • the original code stream transmitted from the encoder including 6 codewords; however, only 1 bit “1” is left after the first 5 codewords are decoded based on the received code stream.
  • the decoder of the receiving end therefore needs to take at least 1 bit from the data frame immediately following the present data frame in combination with the remaining 1 bit of the present frame for completing the decoding process of the sixth codeword. Meanwhile, another erroneous situation takes place, that is, the amount of used (read) data is more than it should be. Besides, the decoded code stream mismatches the original code stream.
  • the VLC may be applied to various audio formats such as Advanced Audio Coding (AAC), Moving Picture Experts Group Audio Layer III (MP3), Free Lossless Audio Codec (FLAC), etc.
  • AAC Advanced Audio Coding
  • MP3 Moving Picture Experts Group Audio Layer III
  • FLAC Free Lossless Audio Codec
  • one conventional solution is to add a Cyclic Redundancy Check (CRC) code to the code stream during encoding, and perform a CRC check upon the data frame for detecting whether the data frame contains error bits after the data frame is completely decoded.
  • CRC Cyclic Redundancy Check
  • said conventional solution does not detect error until the completion of data frame decoding process, and thus cannot obtain an error detection result during the decoding process.
  • said conventional solution has disadvantages on the aspect of preventing the normal system operation from being affected by data frame errors.
  • the present invention therefore discloses an error detection method of a variable-length coding code stream and a decoding and error detection apparatus.
  • an error detection method of Variable-Length Coding (VLC) code stream comprises: decoding a data frame of the code stream; and determining whether the data frame is erroneous according to length information and bit number of decoded data of the data frame.
  • VLC Variable-Length Coding
  • an error detection method of Variable-Length Coding (VLC) code stream comprises: decoding a data frame of the code stream according to a coding table; and determining whether the data frame is erroneous according to the coding table and currently fetched bit number.
  • VLC Variable-Length Coding
  • a decoding and error detection apparatus comprises: a first determining module, coupled to the decoding module; and an error handling module, coupling to the first determining module, wherein after the decoding module decoding a data frame of the code stream, the first determining module determines whether the data frame is erroneous according to length information and bit number of decoded data of the data frame, and when the first determining module determines the data frame is erroneous, the error handling module performs error handling process upon the data frame.
  • a decoding and error detection apparatus comprises: a decoding module; a first determining module, coupled to the decoding module; and an error handling module, coupled to the first determining module, wherein after the decoding module decodes a data frame of the code stream according to a coding table, the first determining module determines whether the data frame is erroneous according to the coding table and currently fetched bit number, when the first determining module determines the data frame is erroneous, the error handling module performs error handling process upon the data frame.
  • FIG. 1 is a diagram illustrating a structure of an embedded audio decoder according to an embodiment of the present invention.
  • FIG. 2 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a first embodiment of the present invention.
  • FIG. 3 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a second embodiment of the present invention.
  • FIG. 4 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a third embodiment of the present invention.
  • FIG. 5 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a fourth embodiment of the present invention.
  • FIG. 6 is a flowchart illustrating an error detection method of a VLC code stream according to a first embodiment of the present invention.
  • FIG. 7 is a flowchart illustrating an error detection method of a VLC code stream according to a second embodiment of the present invention.
  • FIG. 8 is a flowchart illustrating an error detection method of a VLC code stream according to a third embodiment of the present invention.
  • FIG. 9 is a flowchart illustrating an error detection method of a VLC code stream according to a fourth embodiment of the present invention.
  • FIG. 10 is a flowchart illustrating an error detection method of a VLC code stream according to a fifth embodiment of the present invention.
  • FIG. 11 is a flowchart illustrating an error detection method of a VLC code stream according to a sixth embodiment of the present invention.
  • FIG. 12 is a diagram illustrating the structure of an AAC single channel code stream.
  • FIG. 1 is a diagram illustrating a structure of an embedded audio decoder according to an embodiment of the present invention.
  • the embedded audio decoder includes an asynchronous first-in first-out (FIFO) memory 1 , a fetcher 2 , a frame size detecting unit 3 , a controller 4 , a decoding and error detection device 5 , a post-processing module 6 , an audio output module 7 and an analog-to-digital converter (ADC) 8 .
  • FIFO first-in first-out
  • the asynchronous FIFO memory 1 is used for buffering the continuous code stream to be decoded.
  • the fetcher 2 is coupled to the asynchronous FIFO memory 1 , and is used to fetch the code stream to be decoded from the asynchronous FIFO memory 1 .
  • the fetching process may be performed by either a hardware circuit or a software manner. The present invention is not limited to either way.
  • the frame size detecting unit 3 is coupled to the asynchronous FIFO memory 1 , and is used for examining whether the length of data buffered in the asynchronous FIFO memory 1 is at least enough for the current decoding. For example, when decoding the AAC frame header of the AAC data frame, where the AAC frame header length is fixed to 7 bytes, the frame size detecting unit 3 detects whether there is at least 7 bytes of data buffered in the asynchronous FIFO memory 1 .
  • the fetcher 2 is implemented by a hardware circuit.
  • the hardware-based fetching circuit is usually implemented without the buffer error protection function.
  • the frame size detecting unit 3 can effectively avoid the hardware fetching circuit from making mistakes. Accordingly, in this embodiment, the fetcher 2 acknowledges whether the asynchronous FIFO memory 1 preserves enough data buffered therein through the frame size detecting unit 3 before fetching data. In this way, correctness of the fetching operation performed by the fetcher 2 is guaranteed.
  • the controller 4 is coupled to the frame size detecting unit 3 , the decoding and error detection device 5 , and post-processing module 6 , and is used for controlling and coordinating the overall audio decoding process.
  • the controller 4 controls the fetcher 2 to fetch data from the asynchronous FIFO memory 1 and forward the fetched data to the decoding and error detection device 5 to decode and error detect.
  • the controller 4 controls the decoding and error detection device 5 to transmit the decoded code stream to the post-processing module 6 for further processing, thereby recovering the original audio data.
  • the decoding and error detection device 5 is coupled to the fetcher 2 and the post-processing module 6 , and is used for decoding data frames of the code stream and performing error detection upon the data frames according to the length information of the data frames and the bit number of the decoded data.
  • the length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or derived from other information transmitted to the decoder.
  • the decoding and error detection device 5 After the decoding and error detection device 5 obtains data bits from the asynchronous FIFO memory 1 through fetcher 2 , the scaling factor or frequency spectrum information can be decoded by referring to a lookup table (e.g. a binary tree search). During the decoding process, the decoding and error detection device 5 further determines whether the data frame is erroneous. If any error is detected, the error handling process will be performed.
  • a lookup table e.g. a binary tree search
  • the post-processing module 6 is coupled to the decoding and error detection device 5 and the audio output module 7 , and is arranged for receiving the decoded code stream, performing post-processing upon the decoded code stream, and outputting the post-processed data to the audio output module 7 .
  • the post-processing module 6 performs de-quantization, scaling, prediction, sound intensity/coupling, transient noise shaping, filtering and gain control upon the decoded scaling factor or frequency spectrum information, so as to derive the pulse-code modulation (PCM) audio information.
  • PCM pulse-code modulation
  • the audio output module 7 is coupled to the post-processing module 6 and the ADC 8 , and is used to receive the processed data, where the processed data is converted to analog signals via the DAC 8 , and then outputted to a speaker (not shown in the figure).
  • FIG. 2 is a diagram illustrating a structure of the decoding and error detection device 5 shown in FIG. 1 according to a first embodiment of the present invention.
  • the decoding and error detection device 5 includes a decoding module 10 , a first determining module 11 and an error handling module 12 .
  • the decoding module 10 is coupled to the fetcher 2 and the post-processing module 6 , and is used for decoding data frames of the code stream fetched by the fetcher 2 , and further transmitting the decoded data to the post-processing module 6 .
  • the first determining module 11 is coupled to the decoding module 10 . In the course of decoding the data frames in the code stream, the first determining module 11 determines whether the data frames are erroneous according to the length information of the data frames and the bit number of the decoded data.
  • the error handling module 12 is coupled to the first determining module 11 . If any error is detected by the first determining module 11 , the error handling process will be performed upon the data frames.
  • FIG. 3 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a second embodiment of the present invention.
  • the decoding and error detection device 5 includes a decoding module 20 , a first determining module 21 and an error handling module 22 , wherein the first determining module 21 includes a codeword length range deriving unit 211 and a second determining unit 212 .
  • decoding module 20 and the error handling module 22 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2 , the details are omitted here for brevity.
  • the first determining module 21 determines whether the data frame is erroneous according to the coding tables and the bit number of currently fetched data.
  • the codeword length range deriving unit 211 is coupled to the decoding module 20 , and is used for referring the coding tables to obtain the range of codeword lengths of codewords corresponding to the currently fetched bit number.
  • the second determining unit 212 is coupled to the codeword length range deriving unit 211 , and is used for determining whether the currently fetched bit number is within the range of codeword lengths after obtaining the codeword length range from the codeword length range deriving unit 211 . When the second determining unit 212 determines the currently fetched bit number is out of the codeword length range, the error handling process will be performed by the error handling module 22 .
  • FIG. 4 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a third embodiment of the present invention.
  • the decoding and error detection device 5 includes a decoding module 30 , a first determining module 31 and an error handling module 32 , wherein the first determining module 31 includes a remaining bit number deriving unit 311 , a predetermined bit number range deriving unit 312 and a first determining unit 313 .
  • decoding module 30 and the error handling module 32 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2 , the details are omitted here for brevity.
  • the first determining module 31 determines whether the data frame is erroneous by referring to the length information to check whether the accumulated fetched bit number is within a length range of the data frame.
  • the remaining bit number deriving unit 311 is coupled to the decoding module 30 , and is arranged for obtaining bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number.
  • the remaining bit number deriving unit 311 obtains the bit number of the remaining un-decoded data of the data frame according to the length information and the accumulated fetched bit number, wherein the remaining bit number corresponds to the difference between the length of the data frame and the accumulated fetched bit number.
  • the predetermined bit number range deriving unit 312 is coupled to the decoding module 30 , and is used for referring to the coding tables to obtain a range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame.
  • the predetermined bit number range deriving unit 312 obtains ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data of the data frame, respectively, and then obtains the range of the predetermined bit number of the data corresponding to the codewords of the un-decoded data of the data frame according to the ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data, wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data.
  • the first determining unit 313 is coupled to the remaining bit number deriving unit 311 and the predetermined bit number range deriving unit 312 , and is used for obtaining the bit number of the remaining data from the remaining bit number deriving unit 311 and obtaining the range of the predetermined bit number from the predetermined bit number range deriving unit 312 , and determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, wherein when the first determining unit 313 determines that the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, the error handling module 32 will perform error handling process upon the data frame.
  • FIG. 5 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a fourth embodiment of the present invention.
  • the decoding and error detection device 5 includes a decoding module 40 , a first determining module 41 , an error handling module 42 and a second determining module 43 .
  • decoding module 40 and the error handling module 42 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2 respectively, the details are omitted here for brevity.
  • the first determining module 41 determines whether the data frame is erroneous by determining whether the accumulated bit number is within the length range of the data frame according to the length information and determining whether the currently fetched bit number is within the codeword length range.
  • the first determining module 41 includes a remaining bit number deriving unit 411 , a predetermined bit number range deriving unit 412 , a first determining unit 413 , a codeword length range deriving unit 414 and a second determining unit 415 .
  • the remaining bit number deriving unit 411 , the predetermined bit number range deriving unit 412 , the first determining unit 413 are similar to the remaining bit number deriving unit 311 , the predetermined bit number range deriving unit 312 , the first determining unit 313 shown in FIG. 4 , and the codeword length range deriving unit 414 and the second determining unit 415 are similar to the codeword length range deriving unit 211 and the second determining unit 212 shown in FIG. 3 , the details are omitted here for brevity.
  • the second determining module 43 is coupled to the first determining unit 413 and the decoding module 40 .
  • the first determining unit 413 determines that the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data
  • the second determining module 43 will further determine whether all of the codewords of the data frame are completely decoded. If the second determining module 43 determines that not all the codewords of the data frame are completely decoded yet, the decoding module 40 goes on decoding codewords of the current data frame according to the coding tables. If the second determining module 43 determines that all codewords of the data frame are completely decoded, the decoding module 40 goes on to decode the next data frame in the code stream according to the coding tables.
  • FIG. 6 is a flowchart illustrating an error detection method of a VLC code stream according to a first embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 6 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 6 may be briefly summarized as follows.
  • the code stream may comply with one of various audio formats, including AAC, MP3, APE, FLAC, APLC and other VLC formats.
  • the code stream is composed of data frames for carrying the encoded audio data, and the data frames are decoded to recover the audio data in the code stream.
  • the length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or may be derived from other information transmitted to the decoder.
  • the bit number of the decoded data is the bit number of the decoded frame data of the data frame.
  • the decoder can determine whether decoding error of the data frames occurs according to the length information of the data frame and the bit number of the decoded data, and performs a corresponding error handling process when decoding error of the data frames occurs.
  • the error detection method of the VLC code stream determines whether errors occurs in data frames on the basis of length information of the data frames and bit number of the decoded data according to the first embodiment of the present invention. Therefore, the objective of obtaining error detection results of the data frames before Cyclic Redundancy Check (CRC) process to thereby prevent the normal system operation from being affected by data frame errors is achieved. Specifically speaking, the aforementioned method avoids discontinuity of sound, bursts, or even a system crash caused by decoding error of the data frames.
  • CRC Cyclic Redundancy Check
  • FIG. 7 is a flowchart illustrating an error detection method of a VLC code stream according to a second embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 7 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 7 may be briefly summarized as follows.
  • Step S 301 Decode a data frame of the code stream.
  • step S 301 is similar to step S 201 of FIG. 6 , and the details are omitted here for brevity.
  • Step S 302 Determine whether the accumulated fetched bit number is within a length range of the data frame. If yes, go to step S 301 , else, go to step S 303 .
  • the accumulated fetched bit number is obtained by accumulating the bit number of the decoded data of the data frame.
  • the corresponding data bit number (in the unit of byte) are 2, 3, 4, 3 and 2, respectively.
  • the decoding process for the data frame is based on the order of codewords. That is, A1 is decoded before A2, A2 is decoded before A3, and so on. The decoding operation continues till the data frame is completely decoded.
  • the corresponding accumulated fetched bit number is the sum of data bit numbers of A1 and A2, i.e. 5 bytes; further, assuming that A3 is decoded, the corresponding accumulated fetched bit number is the sum of data bit numbers of A1, A2 and A3, i.e. 9 bytes.
  • the length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or may be derived from other information transmitted to the decoder.
  • the obtained length of data frames is 2+3+4+3+2, i.e. 14 bytes.
  • the accumulated fetched bit number is 15 bytes.
  • the accumulated fetched bit number (15 bytes) is greater than the length information (14 bytes).
  • the corresponding accumulated fetched bit number obtained after A4 is decoded is greater than the length of the data frame (i.e. the accumulated fetched bit number obtained when A4 is decoded is not within the length range), which means the data frame is erroneous.
  • the byte position after decoding A5 is the 12 th byte of the data frame, that is, the accumulated fetched bit number is 12 bytes.
  • the accumulated fetched bit number (12 bytes) is less than the length information (14 bytes).
  • the corresponding accumulated fetched bit number obtained after A5 is decoded is less than the length of the data frame (i.e. the accumulated fetched bit number obtained when A5 is decoded is not within the length range), which means the data frame is erroneous.
  • Step S 303 Perform an error handling process upon the data frame.
  • the error handling process includes discarding the erroneous data frame of the code stream, or muting the output of the erroneous data frame of the code stream.
  • the error detection method of the VLC code stream determines whether the accumulated fetched bit number is within a length range of the data frame on the basis of length information of the data frames according to the second embodiment of the present invention. Specifically speaking, when the accumulated fetched bit number exceeds length information of the data frame but the decoding process of the data frame is not completed, or when the accumulated fetched bit number is less than the length information of the data frame and the decoding process of the data frame is completed, an error of the data frame is asserted. Therefore, the objective of obtaining error detection results of the data frames before CRC process to thereby prevent the normal system operation from being affected by data frame errors is achieved.
  • FIG. 8 is a flowchart illustrating an error detection method of a VLC code stream according to a third embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 8 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 8 may be briefly summarized as follows.
  • Step S 401 Decode a data frame of the code stream according to the coding tables.
  • Step S 402 Obtain bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number.
  • the bit number of the remaining un-decoded data of the data frame is derived according to the length information and the accumulated fetched bit number, wherein the accumulated fetched bit number is obtained by accumulating the bit number of the decoded data of the data frame.
  • FIG. 12 the structure of an AAC single channel code stream is shown in FIG. 12
  • the structure of a data frame is shown in Table 2.
  • the data frame includes a frame header, a single channel element (SCE) and a terminator (TERM).
  • the frame header includes a 12-bit syncword “1111_1111_1111” and a 13-bit AAC_frame_length.
  • the SCE includes independent channel stream information (Ics_info) and scale factor band (SFB) information.
  • Ics_info independent channel stream information
  • SCB scale factor band
  • the SFB information is encoded by Huffman VLC, and each SFB information is a codeword.
  • the SFB information is located at the end of a data frame.
  • the TERM is fixed to 0X07 for indicating the end of one data frame.
  • the length of data frame can be obtained by reading the AAC_frame_length.
  • the length is the overall length of the data frame and can be understood as the sum of other data length and SFB information data length, where the other data length is the sum of the header length, the Ics_info length, etc.
  • the data frame length read from the AAC_frame_length is 163 bytes, and the amount of the transmitted SFB information (MAX_SFB) read from the Ics_info is 36.
  • the remaining data bit number RENAIN_BITS of un-decoded data in the data frame equals SFB information length minus the accumulated fetched bit number.
  • the SFB information length 163 bytes ⁇ other data length.
  • Step S 403 Refer to the coding tables to obtain the range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame.
  • step S 403 first of all, the ranges of the corresponding codeword lengths indicated in the coding tables for the remaining un-decoded codewords of the data frame are derived respectively; next, the range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame is obtained according to the codeword ranges, wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of the codeword lengths in the coding tables that are used by the codewords of the un-decoded data.
  • the SCE of the AAC single channel code stream includes section_data
  • the coding table information utilized by each SFB information of the SCE can be obtained from the section_data.
  • the coding table information corresponding to the un-decoded codeword can be derived from the section_data.
  • the coding tables used by the 2 nd -36 th SFB are: the coding table 6 used by the 2 nd -14 th SFB, the coding table 4 used by the 15 th -27 th SFB, and the coding table 2 used by the 28 th -36 th SFB.
  • the range of codeword lengths of the coding table 6 is a range of 4 bits to 11 bits
  • the range of codeword lengths of the coding table 4 is a range of 4 bits to 11 bits
  • the range of codeword lengths of the coding table 2 is a range of 3 bits to 9 bits.
  • the maxima of range of predetermined bit number of data, MAX_BITS is the accumulated summing number of the maximum codeword lengths of the coding tables used by the 2 nd -36 th SFB.
  • the codeword lengths for the 2 nd -14 th SFB (13 in total) are 11 bits
  • the codeword lengths for the 15 th -27 th SFB (13 in total) are 11 bits
  • codeword lengths for the 28 th -36 th SFB (9 in total) are 9 bits
  • the minimum of the range of predetermined bit number of data MIN_BITS is the accumulated summing number of the minimum codeword lengths of the coding tables used by the 2 nd -36 th SFB.
  • the codeword lengths of the 2 nd -14 th SFB are 4 bits
  • the codeword lengths of the 15 th -27 th SFB are 4 bits
  • the codeword lengths for the 28 th -36 th SFB are 3 bits
  • Step S 404 Determine whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data. If the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, step S 405 will be performed; and if the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, step S 407 will be performed.
  • the range of predetermined data bit number is greater than 131 bits and less than or equal to 367 bits. Since 344 bits is within the range of 131 bits to 367 bits, which means that after the first SFB is decoded, the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data. Accordingly, the step S 405 is performed next.
  • the step S 407 is performed next.
  • Step S 405 Determine whether all of the codewords in the data frame are completely decoded. If not, go to step S 401 ; else go to step S 406 .
  • step S 405 the maximum serial number of the decoded codeword and the total number of the codeword of the data frame can be compared with each other to determine whether these two numbers are equal. If not, it means that not all of the codewords in the data frame are completely decoded, and the flow proceeds with step S 401 ; if yes, it means that all of the codewords of the data frame are completely decoded, and the flow proceeds with step S 406 .
  • the maximum serial number of the decoded codeword is 20, which is less than MAX_SFB 36 .
  • the decoding process should be continued for the 21 st SFB.
  • the maximum serial number of the decoded codeword is 36, which equals MAX_SFB, i.e. 36.
  • Step S 406 Decode the next data frame in the code stream according to the coding tables
  • Step S 407 Perform an error handling process upon the data frame.
  • step S 407 after the error handling process is performed upon the data frame, an initial position of the data frame immediately following the erroneous data frame can be confirmed through finding the frame synchronization header, and then the decoding process can be performed upon the following data frame for deriving the original data.
  • the error detection method of the VLC code stream determines whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data according to the third embodiment of the present invention. Therefore, bit reversing or other transmission error happens to the data frame of the code stream during transmission can be detected, thereby preventing the normal system operation from being affected by data frame errors.
  • FIG. 9 is a flowchart illustrating an error detection method of a VLC code stream according to a fourth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 9 need not be in the exact order shown and need not be contiguous.
  • the method shown in FIG. 9 may be briefly summarized as follows:
  • Step S 501 Decode a data frame of the code stream according to the coding tables.
  • step S 501 is similar to step S 401 of FIG. 8 , and the details are omitted here for brevity.
  • Step S 502 Determine whether the data frame is erroneous according to the coding tables and currently fetched bit number.
  • the range of codeword lengths corresponding to the currently fetched bit number is obtained from the coding tables, and it is determined that whether the currently fetched bit number is within the range of the codeword lengths.
  • the error handling process will be performed upon the data frame.
  • the currently fetched bit number is the number of fetched bits corresponding to the codeword being decoded currently.
  • the coding tables are usually stored in a static random access memory (SRAM) or a dynamic random access memory (DRAM), and are addressed along with other system data.
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • the contents of the storage units of the SRAM or DRAM can be accessed arbitrarily. If decoding errors or other abnormal situations occur in the course of the decoding process, the contents of the coding tables may be modified or overwritten while accessing the storage units of the SRAM or DRAM, thus leading to the case that the currently fetched bit number is not within the range of codeword lengths.
  • codewords a 1 , a 2 , a 3 , a 4 , a 5 and a 6 existing in the coding table are 10, 11, 000, 001, 010, 0110, it can be seen that the range of codeword lengths of the current coding table is 2 bits to 4 bits.
  • the codeword a 1 in the coding table is modified to 11011
  • the codeword a 2 in the coding table is modified to 10
  • the code stream needed to be decoded is 1101101011
  • the decoded source symbol of the first codeword is a 1 and the currently fetched bit number corresponding to the first codeword will be 5 bits according to the coding table, i.e.
  • the error handling process may be an operation of re-initializing the coding tables stored in the memory for guaranteeing the correctness of the decoding of the following data frames.
  • the error detection method of the VLC code stream determines whether the data frame is erroneous based on the coding tables and the currently fetched bit number according to the fourth embodiment of the present invention. Therefore, data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.
  • FIG. 10 is a flowchart illustrating an error detection method of a VLC code stream according to a fifth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 10 need not be in the exact order shown and need not be contiguous.
  • FIG. 10 the main difference between the fifth embodiment shown in FIG. 10 and the third embodiment shown in FIG. 8 is that FIG. 10 further includes steps S 601 and S 602 after step S 401 .
  • steps S 601 and S 602 are described as follows.
  • Step S 601 Obtain the range of codeword lengths in the coding tables that are used by codewords corresponding to the currently fetched bit number.
  • step S 401 after step S 401 is executed, the range of codeword lengths corresponding to the currently decoded codeword is obtained, that is, the range of codeword lengths possessed by the currently decoded codeword is obtained.
  • Step S 602 Determine whether the currently fetched bit number is within the range of the codeword lengths. If the currently fetched bit number is within the range of the codeword lengths, the flow goes to step S 402 ; and when the currently fetched bit number is not within the range of codeword lengths, the flow goes to step S 407 .
  • step S 602 when the currently fetched bit number is within the range of codeword lengths, it will be understood that the decoding process of the current codeword of the data frame is normal; and when the currently fetched bit number is not within the range of the codeword length, it will be understood that the decoding process of the current codeword of the data frame is erroneous.
  • the error detection method of the VLC code stream firstly detects whether an error occurs in the data frame by determining whether the currently fetched bit number is within the range of codeword lengths, and then further detecting whether an error occurs in the data frame by determining whether the remaining un-decoded data bit number is within the range of predetermined data bit number. Therefore, bit reversing or other transmission error happens to the data of code stream during transmission as well as data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.
  • FIG. 11 is a flowchart illustrating an error detection method of a VLC code stream according to a sixth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 11 need not be in the exact order shown and need not be contiguous.
  • FIG. 11 the main difference between the sixth embodiment shown in FIG. 11 and the third embodiment shown in FIG. 8 is that FIG. 11 further includes steps S 701 and S 702 after step S 404 .
  • Steps S 701 and S 702 of the flowchart shown in FIG. 11 are similar to steps S 601 and S 602 shown in FIG. 10 . All of the other steps included in the flowchart shown in FIG. 11 have been disclosed in FIG. 8 . Therefore, the details are omitted here for brevity.
  • the error detection method of the VLC code stream firstly detects whether an error occurs in the data frame by determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, and then further detecting whether an error occurs in the data frame by determining whether the currently fetched bit number is within the range of codeword lengths. Therefore, bit reversing or other transmission error happens to the data of the code stream during transmission as well as data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)

Abstract

An error detection method of a variable-length coding (VLC) code stream includes at least the following steps: decoding a data frame of the VLC code stream; and determining whether the data frame is erroneous according to length information of the data frame and a bit number of decoded data of the data frame. According to the method, the present invention realizes the objective of performing error detection upon data frames during the decoding process.

Description

BACKGROUND
The disclosed embodiments of the present invention relate to audio signal processing, and more particularly, to an error detection method of a variable-length coding code stream and a related decoding and error detection apparatus.
The Variable-Length Coding (VLC) is a coding method which performs coding upon data by using codewords with various lengths. Specifically speaking, the VLC employs shorter codewords to encode data with higher occurrence probability, and employs longer codewords to encode data with lower occurrence probability. The overall encoding efficiency is improved accordingly. Since lengths of the codewords employed by the VLC are not fixed, the exact data amount required to be decoded is unknown before the decoding process is completed. Conventionally, decoding a data frame may need to look up a coding table based on a codeword, thereby restoring an initial value corresponding to the codeword. By referring to the coding table, information, such as length range of a codeword and the correspondence between the codeword and the initial value, can be obtained. However, if bit reversing or other transmission errors happen to the data of a code stream during transmission, the data amount read by the decoder may be affected, resulting in that the decoded code stream differs from the original code stream.
Specifically, the VLC includes Huffman coding, Shannon-Fano algorithm, Exponential-Golomb coding, etc. Taking the Huffman coding for example, suppose the intraframe source symbols of the original code stream required to be transmitted are a1, a5, a7, a1, a3 and a4, the original code stream 10, 010, 0111, 10, 000 and 001 can be derived by encoding the source symbols according to the correspondence between the source symbols and the codewords in a Huffman coding table (Table 1).
TABLE 1
source Probability Huffman codeword
symbol ai p(ai) codeword Wi length Ki
a1 0.20 10 2
a2 0.19 11 2
a3 0.18 000 3
a4 0.17 001 3
a5 0.15 010 3
a6 0.10 0110 4
a7 0.01 0111 4
During the transmission, errors may occur due to channel instability or other reasons, thus resulting in variation of the received code stream. Assuming that the code stream received by the receiving end is composed of 10, 011, 0111, 10, 000 and 001, when decoding the received code stream, the receiving end firstly reads the codeword “10” and derives a corresponding decoded source symbol as a1. Then the receiving end reads the codeword “011”, while no corresponding source symbol can be found in Table 1. Therefore, the receiving end will falsely employ the following bit “0” as part of the present codeword (i.e. the read codeword will be “0110”), and derive a corresponding decoded source symbol as a6. The decoding process continues by sequentially reading the code stream. After 6 codewords are decoded, the derived source symbols are a1, a6, a2, a2, a3 and a3 respectively, while the last bit of the received code stream “1” is unused. Said scenario is an example of how an erroneous decoding takes place, that is, the amount of used (read) data is less than it should be. Besides, the decoded code stream mismatches the original code stream.
Further, assuming that the received code stream is composed of 10, 011, 0011, 10, 000 and 001, the source symbols corresponding to the first 5 codewords are a1, a6, a7, a3 and a3, respectively. The original code stream transmitted from the encoder including 6 codewords; however, only 1 bit “1” is left after the first 5 codewords are decoded based on the received code stream. As the shortest bit-length of the Huffman codeword shown in Table 1 is 2, the decoder of the receiving end therefore needs to take at least 1 bit from the data frame immediately following the present data frame in combination with the remaining 1 bit of the present frame for completing the decoding process of the sixth codeword. Meanwhile, another erroneous situation takes place, that is, the amount of used (read) data is more than it should be. Besides, the decoded code stream mismatches the original code stream.
On the other hand, if the coding table changes in the course of decoding the received code stream, it will lead to mismatch between the decoded code stream and the original code stream.
In practice, the VLC may be applied to various audio formats such as Advanced Audio Coding (AAC), Moving Picture Experts Group Audio Layer III (MP3), Free Lossless Audio Codec (FLAC), etc. There are reasons (e.g. instability of the transmission channel) that may result in erroneous code stream. Further, erroneous storing process of the coding table may result in decoding error of the data frames of the code stream. Both might lead to discontinuity of sound, bursts, or even a system crash.
In order to solve the aforementioned issues, one conventional solution is to add a Cyclic Redundancy Check (CRC) code to the code stream during encoding, and perform a CRC check upon the data frame for detecting whether the data frame contains error bits after the data frame is completely decoded. However, said conventional solution does not detect error until the completion of data frame decoding process, and thus cannot obtain an error detection result during the decoding process. As a result, said conventional solution has disadvantages on the aspect of preventing the normal system operation from being affected by data frame errors.
SUMMARY
In light of the above mentioned issues, the present invention therefore discloses an error detection method of a variable-length coding code stream and a decoding and error detection apparatus.
According to an embodiment of the present invention, an error detection method of Variable-Length Coding (VLC) code stream is disclosed, the method comprises: decoding a data frame of the code stream; and determining whether the data frame is erroneous according to length information and bit number of decoded data of the data frame.
According to another embodiment of the present invention, an error detection method of Variable-Length Coding (VLC) code stream is disclosed, the method comprises: decoding a data frame of the code stream according to a coding table; and determining whether the data frame is erroneous according to the coding table and currently fetched bit number.
According to yet another embodiment of the present invention, a decoding and error detection apparatus is disclosed, the apparatus comprises: a first determining module, coupled to the decoding module; and an error handling module, coupling to the first determining module, wherein after the decoding module decoding a data frame of the code stream, the first determining module determines whether the data frame is erroneous according to length information and bit number of decoded data of the data frame, and when the first determining module determines the data frame is erroneous, the error handling module performs error handling process upon the data frame.
According to still yet another embodiment of the present invention, a decoding and error detection apparatus is disclosed, the apparatus comprises: a decoding module; a first determining module, coupled to the decoding module; and an error handling module, coupled to the first determining module, wherein after the decoding module decodes a data frame of the code stream according to a coding table, the first determining module determines whether the data frame is erroneous according to the coding table and currently fetched bit number, when the first determining module determines the data frame is erroneous, the error handling module performs error handling process upon the data frame.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a diagram illustrating a structure of an embedded audio decoder according to an embodiment of the present invention.
FIG. 2 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a first embodiment of the present invention.
FIG. 3 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a second embodiment of the present invention.
FIG. 4 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a third embodiment of the present invention.
FIG. 5 is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a fourth embodiment of the present invention.
FIG. 6 is a flowchart illustrating an error detection method of a VLC code stream according to a first embodiment of the present invention.
FIG. 7 is a flowchart illustrating an error detection method of a VLC code stream according to a second embodiment of the present invention.
FIG. 8 is a flowchart illustrating an error detection method of a VLC code stream according to a third embodiment of the present invention.
FIG. 9 is a flowchart illustrating an error detection method of a VLC code stream according to a fourth embodiment of the present invention.
FIG. 10 is a flowchart illustrating an error detection method of a VLC code stream according to a fifth embodiment of the present invention.
FIG. 11 is a flowchart illustrating an error detection method of a VLC code stream according to a sixth embodiment of the present invention.
FIG. 12 is a diagram illustrating the structure of an AAC single channel code stream.
DETAILED DESCRIPTION
Certain terms are used throughout the description and following claims to refer to particular components. As one skilled in the art will appreciate, manufacturers may refer to a component by different names. This document does not intend to distinguish between components that differ in name but not function. In the following description and in the claims, the terms “include” and “comprise” are used in an open-ended fashion, and thus should be interpreted to mean “include, but not limited to . . . ”. Also, the term “couple” is intended to mean either an indirect or direct electrical connection. Accordingly, if one device is coupled to another device, that connection may be through a direct electrical connection, or through an indirect electrical connection via other devices and connections.
Please refer to FIG. 1, which is a diagram illustrating a structure of an embedded audio decoder according to an embodiment of the present invention. As shown in FIG. 1, the embedded audio decoder includes an asynchronous first-in first-out (FIFO) memory 1, a fetcher 2, a frame size detecting unit 3, a controller 4, a decoding and error detection device 5, a post-processing module 6, an audio output module 7 and an analog-to-digital converter (ADC) 8.
The asynchronous FIFO memory 1 is used for buffering the continuous code stream to be decoded. The fetcher 2 is coupled to the asynchronous FIFO memory 1, and is used to fetch the code stream to be decoded from the asynchronous FIFO memory 1. In an embedded system, the fetching process may be performed by either a hardware circuit or a software manner. The present invention is not limited to either way.
The frame size detecting unit 3 is coupled to the asynchronous FIFO memory 1, and is used for examining whether the length of data buffered in the asynchronous FIFO memory 1 is at least enough for the current decoding. For example, when decoding the AAC frame header of the AAC data frame, where the AAC frame header length is fixed to 7 bytes, the frame size detecting unit 3 detects whether there is at least 7 bytes of data buffered in the asynchronous FIFO memory 1.
In this embodiment, the fetcher 2 is implemented by a hardware circuit. As realizing the buffer error protection function requires to increase the circuit area and adopt a more complicated design, which dramatically increases the cost, the hardware-based fetching circuit is usually implemented without the buffer error protection function. The frame size detecting unit 3 can effectively avoid the hardware fetching circuit from making mistakes. Accordingly, in this embodiment, the fetcher 2 acknowledges whether the asynchronous FIFO memory 1 preserves enough data buffered therein through the frame size detecting unit 3 before fetching data. In this way, correctness of the fetching operation performed by the fetcher 2 is guaranteed. The controller 4 is coupled to the frame size detecting unit 3, the decoding and error detection device 5, and post-processing module 6, and is used for controlling and coordinating the overall audio decoding process. When the frame size detecting unit 3 detects that the length of data buffered in the asynchronous FIFO memory 1 is enough for the current decoding, the controller 4 controls the fetcher 2 to fetch data from the asynchronous FIFO memory 1 and forward the fetched data to the decoding and error detection device 5 to decode and error detect. After the decoding and error detection process is completed, the controller 4 controls the decoding and error detection device 5 to transmit the decoded code stream to the post-processing module 6 for further processing, thereby recovering the original audio data.
The decoding and error detection device 5 is coupled to the fetcher 2 and the post-processing module 6, and is used for decoding data frames of the code stream and performing error detection upon the data frames according to the length information of the data frames and the bit number of the decoded data. The length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or derived from other information transmitted to the decoder.
Taking the AAC decoding for example, after the decoding and error detection device 5 obtains data bits from the asynchronous FIFO memory 1 through fetcher 2, the scaling factor or frequency spectrum information can be decoded by referring to a lookup table (e.g. a binary tree search). During the decoding process, the decoding and error detection device 5 further determines whether the data frame is erroneous. If any error is detected, the error handling process will be performed.
The post-processing module 6 is coupled to the decoding and error detection device 5 and the audio output module 7, and is arranged for receiving the decoded code stream, performing post-processing upon the decoded code stream, and outputting the post-processed data to the audio output module 7. Taking the AAC decoding for example, the post-processing module 6 performs de-quantization, scaling, prediction, sound intensity/coupling, transient noise shaping, filtering and gain control upon the decoded scaling factor or frequency spectrum information, so as to derive the pulse-code modulation (PCM) audio information. As those persons skilled in the art readily understand details of the post-processing module 6, further description is omitted here for brevity.
The audio output module 7 is coupled to the post-processing module 6 and the ADC 8, and is used to receive the processed data, where the processed data is converted to analog signals via the DAC 8, and then outputted to a speaker (not shown in the figure).
Please refer to FIG. 2, which is a diagram illustrating a structure of the decoding and error detection device 5 shown in FIG. 1 according to a first embodiment of the present invention. As shown in FIG. 2, the decoding and error detection device 5 includes a decoding module 10, a first determining module 11 and an error handling module 12.
The decoding module 10 is coupled to the fetcher 2 and the post-processing module 6, and is used for decoding data frames of the code stream fetched by the fetcher 2, and further transmitting the decoded data to the post-processing module 6. The first determining module 11 is coupled to the decoding module 10. In the course of decoding the data frames in the code stream, the first determining module 11 determines whether the data frames are erroneous according to the length information of the data frames and the bit number of the decoded data. The error handling module 12 is coupled to the first determining module 11. If any error is detected by the first determining module 11, the error handling process will be performed upon the data frames.
Please refer to FIG. 3, which is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a second embodiment of the present invention. As shown in FIG. 3, the decoding and error detection device 5 includes a decoding module 20, a first determining module 21 and an error handling module 22, wherein the first determining module 21 includes a codeword length range deriving unit 211 and a second determining unit 212.
As the decoding module 20 and the error handling module 22 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2, the details are omitted here for brevity.
When the decoding module 20 decodes the data frame according to the coding tables, the first determining module 21 determines whether the data frame is erroneous according to the coding tables and the bit number of currently fetched data.
Specifically speaking, the codeword length range deriving unit 211 is coupled to the decoding module 20, and is used for referring the coding tables to obtain the range of codeword lengths of codewords corresponding to the currently fetched bit number. The second determining unit 212 is coupled to the codeword length range deriving unit 211, and is used for determining whether the currently fetched bit number is within the range of codeword lengths after obtaining the codeword length range from the codeword length range deriving unit 211. When the second determining unit 212 determines the currently fetched bit number is out of the codeword length range, the error handling process will be performed by the error handling module 22.
Please refer to FIG. 4, which is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a third embodiment of the present invention. As shown in FIG. 4, the decoding and error detection device 5 includes a decoding module 30, a first determining module 31 and an error handling module 32, wherein the first determining module 31 includes a remaining bit number deriving unit 311, a predetermined bit number range deriving unit 312 and a first determining unit 313.
As the decoding module 30 and the error handling module 32 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2, the details are omitted here for brevity.
When the decoding module 30 decodes the data frame according to the coding tables, the first determining module 31 determines whether the data frame is erroneous by referring to the length information to check whether the accumulated fetched bit number is within a length range of the data frame.
Specifically speaking, the remaining bit number deriving unit 311 is coupled to the decoding module 30, and is arranged for obtaining bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number. The remaining bit number deriving unit 311 obtains the bit number of the remaining un-decoded data of the data frame according to the length information and the accumulated fetched bit number, wherein the remaining bit number corresponds to the difference between the length of the data frame and the accumulated fetched bit number.
The predetermined bit number range deriving unit 312 is coupled to the decoding module 30, and is used for referring to the coding tables to obtain a range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame. Specifically speaking, the predetermined bit number range deriving unit 312 obtains ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data of the data frame, respectively, and then obtains the range of the predetermined bit number of the data corresponding to the codewords of the un-decoded data of the data frame according to the ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data, wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data.
The first determining unit 313 is coupled to the remaining bit number deriving unit 311 and the predetermined bit number range deriving unit 312, and is used for obtaining the bit number of the remaining data from the remaining bit number deriving unit 311 and obtaining the range of the predetermined bit number from the predetermined bit number range deriving unit 312, and determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, wherein when the first determining unit 313 determines that the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, the error handling module 32 will perform error handling process upon the data frame.
Please refer to FIG. 5, which is a diagram illustrating a structure of the decoding and error detection device shown in FIG. 1 according to a fourth embodiment of the present invention. As shown in FIG. 5, the decoding and error detection device 5 includes a decoding module 40, a first determining module 41, an error handling module 42 and a second determining module 43.
As the decoding module 40 and the error handling module 42 are similar to the decoding module 10 and the error handling module 12 of the first embodiment in FIG. 2 respectively, the details are omitted here for brevity.
When the decoding module 40 decodes the data frame according to the coding tables, the first determining module 41 determines whether the data frame is erroneous by determining whether the accumulated bit number is within the length range of the data frame according to the length information and determining whether the currently fetched bit number is within the codeword length range.
Specifically speaking, the first determining module 41 includes a remaining bit number deriving unit 411, a predetermined bit number range deriving unit 412, a first determining unit 413, a codeword length range deriving unit 414 and a second determining unit 415.
As the remaining bit number deriving unit 411, the predetermined bit number range deriving unit 412, the first determining unit 413 are similar to the remaining bit number deriving unit 311, the predetermined bit number range deriving unit 312, the first determining unit 313 shown in FIG. 4, and the codeword length range deriving unit 414 and the second determining unit 415 are similar to the codeword length range deriving unit 211 and the second determining unit 212 shown in FIG. 3, the details are omitted here for brevity.
Furthermore, the second determining module 43 is coupled to the first determining unit 413 and the decoding module 40. When the first determining unit 413 determines that the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, the second determining module 43 will further determine whether all of the codewords of the data frame are completely decoded. If the second determining module 43 determines that not all the codewords of the data frame are completely decoded yet, the decoding module 40 goes on decoding codewords of the current data frame according to the coding tables. If the second determining module 43 determines that all codewords of the data frame are completely decoded, the decoding module 40 goes on to decode the next data frame in the code stream according to the coding tables.
FIG. 6 is a flowchart illustrating an error detection method of a VLC code stream according to a first embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 6 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 6 may be briefly summarized as follows.
    • Step S201: Decode a data frame of the code stream;
    • Step S202: Determine whether the data frame is erroneous according to length information and bit number of decoded data of the data frame.
In step S201, the code stream may comply with one of various audio formats, including AAC, MP3, APE, FLAC, APLC and other VLC formats. The code stream is composed of data frames for carrying the encoded audio data, and the data frames are decoded to recover the audio data in the code stream.
In step S202, the length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or may be derived from other information transmitted to the decoder. The bit number of the decoded data is the bit number of the decoded frame data of the data frame. The decoder can determine whether decoding error of the data frames occurs according to the length information of the data frame and the bit number of the decoded data, and performs a corresponding error handling process when decoding error of the data frames occurs.
By employing the aforementioned method, the error detection method of the VLC code stream determines whether errors occurs in data frames on the basis of length information of the data frames and bit number of the decoded data according to the first embodiment of the present invention. Therefore, the objective of obtaining error detection results of the data frames before Cyclic Redundancy Check (CRC) process to thereby prevent the normal system operation from being affected by data frame errors is achieved. Specifically speaking, the aforementioned method avoids discontinuity of sound, bursts, or even a system crash caused by decoding error of the data frames.
FIG. 7 is a flowchart illustrating an error detection method of a VLC code stream according to a second embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 7 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 7 may be briefly summarized as follows.
Step S301: Decode a data frame of the code stream.
In this embodiment, step S301 is similar to step S201 of FIG. 6, and the details are omitted here for brevity.
Step S302: Determine whether the accumulated fetched bit number is within a length range of the data frame. If yes, go to step S301, else, go to step S303. In step S302, the accumulated fetched bit number is obtained by accumulating the bit number of the decoded data of the data frame.
For example, assuming that 5 codewords A1, A2, A3, A4 and A5 are included in the data frame, the corresponding data bit number (in the unit of byte) are 2, 3, 4, 3 and 2, respectively. Usually, the decoding process for the data frame is based on the order of codewords. That is, A1 is decoded before A2, A2 is decoded before A3, and so on. The decoding operation continues till the data frame is completely decoded. Under a normal decoding condition, assuming that A2 is decoded, the corresponding accumulated fetched bit number is the sum of data bit numbers of A1 and A2, i.e. 5 bytes; further, assuming that A3 is decoded, the corresponding accumulated fetched bit number is the sum of data bit numbers of A1, A2 and A3, i.e. 9 bytes.
In the following, a detailed operation process of determining whether the accumulated fetched bit number is within a length range of the data frame according to the length information of the data frame will be described.
The length information of the data frames may be derived from the information provided by the headers of the data frames or the specification of the data frames, or may be derived from other information transmitted to the decoder. In this embodiment, the obtained length of data frames is 2+3+4+3+2, i.e. 14 bytes.
Assume that the byte position after decoding A4 is the 15th byte of the data frame, that is, the accumulated fetched bit number is 15 bytes. The accumulated fetched bit number (15 bytes) is greater than the length information (14 bytes). Hence, it can be determined that the corresponding accumulated fetched bit number obtained after A4 is decoded is greater than the length of the data frame (i.e. the accumulated fetched bit number obtained when A4 is decoded is not within the length range), which means the data frame is erroneous.
Assume that the byte position after decoding A5, the last data to be decoded, is the 12th byte of the data frame, that is, the accumulated fetched bit number is 12 bytes. The accumulated fetched bit number (12 bytes) is less than the length information (14 bytes). Hence, it can be determined that the corresponding accumulated fetched bit number obtained after A5 is decoded is less than the length of the data frame (i.e. the accumulated fetched bit number obtained when A5 is decoded is not within the length range), which means the data frame is erroneous.
Step S303: Perform an error handling process upon the data frame. In step S303, the error handling process includes discarding the erroneous data frame of the code stream, or muting the output of the erroneous data frame of the code stream.
By employing the aforementioned method, the error detection method of the VLC code stream determines whether the accumulated fetched bit number is within a length range of the data frame on the basis of length information of the data frames according to the second embodiment of the present invention. Specifically speaking, when the accumulated fetched bit number exceeds length information of the data frame but the decoding process of the data frame is not completed, or when the accumulated fetched bit number is less than the length information of the data frame and the decoding process of the data frame is completed, an error of the data frame is asserted. Therefore, the objective of obtaining error detection results of the data frames before CRC process to thereby prevent the normal system operation from being affected by data frame errors is achieved.
FIG. 8 is a flowchart illustrating an error detection method of a VLC code stream according to a third embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 8 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 8 may be briefly summarized as follows.
Step S401: Decode a data frame of the code stream according to the coding tables.
Step S402: Obtain bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number. In step S402, the bit number of the remaining un-decoded data of the data frame is derived according to the length information and the accumulated fetched bit number, wherein the accumulated fetched bit number is obtained by accumulating the bit number of the decoded data of the data frame.
For example, the structure of an AAC single channel code stream is shown in FIG. 12, and the structure of a data frame is shown in Table 2.
TABLE 2
FRAME HEADER SCE TERM
Syncword AAC_Frame_Length Ics_info Section_Data SFB 0X07
As shown in FIG. 12, the data frame includes a frame header, a single channel element (SCE) and a terminator (TERM). Specifically speaking, please also refer to table 2, the frame header includes a 12-bit syncword “1111_1111_1111” and a 13-bit AAC_frame_length. The SCE includes independent channel stream information (Ics_info) and scale factor band (SFB) information. The SFB information is encoded by Huffman VLC, and each SFB information is a codeword. The SFB information is located at the end of a data frame. The TERM is fixed to 0X07 for indicating the end of one data frame.
In the course of decoding the data frames, the length of data frame can be obtained by reading the AAC_frame_length. The length is the overall length of the data frame and can be understood as the sum of other data length and SFB information data length, where the other data length is the sum of the header length, the Ics_info length, etc.
It is assumed that the data frame length read from the AAC_frame_length is 163 bytes, and the amount of the transmitted SFB information (MAX_SFB) read from the Ics_info is 36.
During the frame decoding process, when the first SFB is completely decoded, and the current decoding position at this moment is the 120th byte of the data frame (i.e. the accumulated fetched bit number is 120 bytes minus other data length), the remaining data bit number RENAIN_BITS of un-decoded data in the data frame equals SFB information length minus the accumulated fetched bit number. According to the structure mentioned above, the SFB information length=163 bytes−other data length. Hence the remaining data bit number of un-decoded data in the data frame is expressed as below: RENAIN_BITS=SFB information length−the accumulated fetched bit number=163−120=43 bytes.
Step S403: Refer to the coding tables to obtain the range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame. In step S403, first of all, the ranges of the corresponding codeword lengths indicated in the coding tables for the remaining un-decoded codewords of the data frame are derived respectively; next, the range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame is obtained according to the codeword ranges, wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of the codeword lengths in the coding tables that are used by the codewords of the un-decoded data.
For example, the SCE of the AAC single channel code stream includes section_data, and the coding table information utilized by each SFB information of the SCE can be obtained from the section_data. Specifically speaking, the coding table information corresponding to the un-decoded codeword can be derived from the section_data. For instance, it can be known from the section_data that the coding tables used by the 2nd-36th SFB are: the coding table 6 used by the 2nd-14th SFB, the coding table 4 used by the 15th-27th SFB, and the coding table 2 used by the 28th-36th SFB. For example, the range of codeword lengths of the coding table 6 is a range of 4 bits to 11 bits, the range of codeword lengths of the coding table 4 is a range of 4 bits to 11 bits, and the range of codeword lengths of the coding table 2 is a range of 3 bits to 9 bits.
The maxima of range of predetermined bit number of data, MAX_BITS is the accumulated summing number of the maximum codeword lengths of the coding tables used by the 2nd-36th SFB. When the codeword lengths for the 2nd-14th SFB (13 in total) are 11 bits, the codeword lengths for the 15th-27th SFB (13 in total) are 11 bits, and codeword lengths for the 28th-36th SFB (9 in total) are 9 bits, the maximum codeword range MAX_BITS=11*13+11*13+9*9=367 bits.
The minimum of the range of predetermined bit number of data MIN_BITS is the accumulated summing number of the minimum codeword lengths of the coding tables used by the 2nd-36th SFB. When the codeword lengths of the 2nd-14th SFB are 4 bits, the codeword lengths of the 15th-27th SFB are 4 bits, and the codeword lengths for the 28th-36th SFB are 3 bits, the minimum codeword range MIN_BITS=4*13+4*13+3*9=131 bits.
Step S404: Determine whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data. If the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, step S405 will be performed; and if the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, step S407 will be performed.
Taking the AAC single channel code stream for example, when the first SFB is decoded and the remaining data bit number is 43 bytes, i.e. 344 bits, the range of predetermined data bit number is greater than 131 bits and less than or equal to 367 bits. Since 344 bits is within the range of 131 bits to 367 bits, which means that after the first SFB is decoded, the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data. Accordingly, the step S405 is performed next.
Assuming that when the first SFB is decoded and the decoding position is the 116th byte of the data frame, the remaining data bit number=163−116=47 bytes, i.e. 374 bits, which is greater than the upper limit of the predetermined bit number of data, 367 bits. This means that after the first SFB is decoded, the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data. Accordingly, the step S407 is performed next.
Step S405: Determine whether all of the codewords in the data frame are completely decoded. If not, go to step S401; else go to step S406. In step S405, the maximum serial number of the decoded codeword and the total number of the codeword of the data frame can be compared with each other to determine whether these two numbers are equal. If not, it means that not all of the codewords in the data frame are completely decoded, and the flow proceeds with step S401; if yes, it means that all of the codewords of the data frame are completely decoded, and the flow proceeds with step S406.
Taking the AAC single channel code stream for example, when the 20th SFB is decoded, the maximum serial number of the decoded codeword is 20, which is less than MAX_SFB 36. Hence, the decoding process should be continued for the 21st SFB. When the 36th SFB is decoded, the maximum serial number of the decoded codeword is 36, which equals MAX_SFB, i.e. 36. Hence, the decoding process of the data frame is completed, and the decoding process should be continued for the next data frame in the code stream.
Step S406: Decode the next data frame in the code stream according to the coding tables;
Step S407: Perform an error handling process upon the data frame. In step S407, after the error handling process is performed upon the data frame, an initial position of the data frame immediately following the erroneous data frame can be confirmed through finding the frame synchronization header, and then the decoding process can be performed upon the following data frame for deriving the original data.
By employing the aforementioned method, the error detection method of the VLC code stream determines whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data according to the third embodiment of the present invention. Therefore, bit reversing or other transmission error happens to the data frame of the code stream during transmission can be detected, thereby preventing the normal system operation from being affected by data frame errors.
FIG. 9 is a flowchart illustrating an error detection method of a VLC code stream according to a fourth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 9 need not be in the exact order shown and need not be contiguous. The method shown in FIG. 9 may be briefly summarized as follows:
Step S501: Decode a data frame of the code stream according to the coding tables. In this embodiment, step S501 is similar to step S401 of FIG. 8, and the details are omitted here for brevity.
Step S502: Determine whether the data frame is erroneous according to the coding tables and currently fetched bit number. In step S502, the range of codeword lengths corresponding to the currently fetched bit number is obtained from the coding tables, and it is determined that whether the currently fetched bit number is within the range of the codeword lengths. When the currently fetched bit number is not within the range of the codeword lengths, the error handling process will be performed upon the data frame.
The currently fetched bit number is the number of fetched bits corresponding to the codeword being decoded currently. In an embedded system, the coding tables are usually stored in a static random access memory (SRAM) or a dynamic random access memory (DRAM), and are addressed along with other system data. Those persons skilled in the art should readily understand that the contents of the storage units of the SRAM or DRAM can be accessed arbitrarily. If decoding errors or other abnormal situations occur in the course of the decoding process, the contents of the coding tables may be modified or overwritten while accessing the storage units of the SRAM or DRAM, thus leading to the case that the currently fetched bit number is not within the range of codeword lengths.
For instance, assuming 6 codewords a1, a2, a3, a4, a5 and a6 existing in the coding table are 10, 11, 000, 001, 010, 0110, it can be seen that the range of codeword lengths of the current coding table is 2 bits to 4 bits. During the decoding process, if the codeword a1 in the coding table is modified to 11011, the codeword a2 in the coding table is modified to 10, and the code stream needed to be decoded is 1101101011, then the decoded source symbol of the first codeword is a1 and the currently fetched bit number corresponding to the first codeword will be 5 bits according to the coding table, i.e. 11011, which is greater than the maximum codeword length, 4 bits, of the current coding table. This indicates that the currently fetched number is not within the range of codeword length of the coding table. Therefore, it is determined that error occurs during the data frame decoding process, and thus the error handling process will be performed.
In this embodiment, the error handling process may be an operation of re-initializing the coding tables stored in the memory for guaranteeing the correctness of the decoding of the following data frames.
By employing the aforementioned method, the error detection method of the VLC code stream determines whether the data frame is erroneous based on the coding tables and the currently fetched bit number according to the fourth embodiment of the present invention. Therefore, data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.
FIG. 10 is a flowchart illustrating an error detection method of a VLC code stream according to a fifth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 10 need not be in the exact order shown and need not be contiguous.
As shown in FIG. 10, the main difference between the fifth embodiment shown in FIG. 10 and the third embodiment shown in FIG. 8 is that FIG. 10 further includes steps S601 and S602 after step S401. The details of steps S601 and S602 are described as follows.
Step S601: Obtain the range of codeword lengths in the coding tables that are used by codewords corresponding to the currently fetched bit number.
Specifically speaking, on the basis of the embodiment of FIG. 8, after step S401 is executed, the range of codeword lengths corresponding to the currently decoded codeword is obtained, that is, the range of codeword lengths possessed by the currently decoded codeword is obtained.
Step S602: Determine whether the currently fetched bit number is within the range of the codeword lengths. If the currently fetched bit number is within the range of the codeword lengths, the flow goes to step S402; and when the currently fetched bit number is not within the range of codeword lengths, the flow goes to step S407. In step S602, when the currently fetched bit number is within the range of codeword lengths, it will be understood that the decoding process of the current codeword of the data frame is normal; and when the currently fetched bit number is not within the range of the codeword length, it will be understood that the decoding process of the current codeword of the data frame is erroneous.
All of the other steps included in the flowchart shown in FIG. 10 have been disclosed in FIG. 8. Therefore, the details are omitted here for brevity. By employing the aforementioned method, the error detection method of the VLC code stream firstly detects whether an error occurs in the data frame by determining whether the currently fetched bit number is within the range of codeword lengths, and then further detecting whether an error occurs in the data frame by determining whether the remaining un-decoded data bit number is within the range of predetermined data bit number. Therefore, bit reversing or other transmission error happens to the data of code stream during transmission as well as data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.
FIG. 11 is a flowchart illustrating an error detection method of a VLC code stream according to a sixth embodiment of the present invention. Provided that substantially the same result is achieved, the steps of the flowchart shown in FIG. 11 need not be in the exact order shown and need not be contiguous.
As shown in FIG. 11, the main difference between the sixth embodiment shown in FIG. 11 and the third embodiment shown in FIG. 8 is that FIG. 11 further includes steps S701 and S702 after step S404. Steps S701 and S702 of the flowchart shown in FIG. 11 are similar to steps S601 and S602 shown in FIG. 10. All of the other steps included in the flowchart shown in FIG. 11 have been disclosed in FIG. 8. Therefore, the details are omitted here for brevity.
By employing the aforementioned method, the error detection method of the VLC code stream firstly detects whether an error occurs in the data frame by determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, and then further detecting whether an error occurs in the data frame by determining whether the currently fetched bit number is within the range of codeword lengths. Therefore, bit reversing or other transmission error happens to the data of the code stream during transmission as well as data frame errors introduced by variation of the coding tables stored in the RAM can be detected, thereby preventing the normal system operation from being affected by data frame errors.
The above is only embodiments of the present invention, and is not a limitation of the present invention patent. Any equivalent structure or process transformation, or directly or indirectly application in other technical fields made by use of the contents of the specification and drawings of the present invention all equivalently fall within the scope of present invention.

Claims (12)

What is claimed is:
1. An error detection method of a variable-length coding (VLC) code stream, comprising:
decoding a data frame of the VLC code stream by a decoder, comprising:
decoding the data frame according to coding tables; wherein an accumulated fetched bit number is obtained by accumulating a bit number of the decoded data of the data frame; and
determining whether the data frame is erroneous according to length information of the data frame and the accumulated fetched bit number of the data frame by a determining module, comprising:
obtaining a bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number;
obtaining a range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame according to the coding tables;
determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data; and when the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, performing an error handling process upon the data frame.
2. The error detection method of the VLC code stream of claim 1, wherein the step of determining whether the data frame is erroneous according to the length information of the data frame and an accumulated fetched bit number of the data frame comprises:
determining whether the accumulated fetched bit number is within a length range indicated by the length information; and
when the accumulated fetched bit number is not within the length range, performing an error handling process upon the data frame.
3. The error detection method of the VLC code stream of claim 1, wherein the step of obtaining the bit number of the remaining un-decoded data of the data frame according to the accumulated fetched bit number comprises:
obtaining the bit number of the remaining un-decoded data of the data frame according to the length information and the accumulated fetched bit number.
4. The error detection method of the VLC code stream of claim 3, wherein the step of obtaining the range of the predetermined bit number of the data corresponding to the codewords of the un-decoded data of the data frame according to the coding tables comprises:
obtaining ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data of the data frame, respectively; and
obtaining the range of the predetermined bit number of the data corresponding to the codewords of the un-decoded data of the data frame according to the ranges of the codeword lengths in the coding tables that are used by the codewords of the un-decoded data;
wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of the codeword lengths in the coding tables that are used by the codewords of the un-decoded data.
5. The error detection method of VLC code stream of claim 1, wherein the accumulated fetched bit number further comprises a currently fetched bit number, and the method further comprises:
obtaining a range of codeword lengths of codewords in the coding tables that correspond to the currently fetched bit number;
determining whether the currently fetched bit number is within the range of codeword lengths; and
when the currently fetched bit number is not within the range of codeword lengths, performing an error handling process upon the data frame.
6. The error detection method of the VLC code stream of claim 1, further comprising:
when the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, further determining whether all codewords in the data frame are completely decoded; and
when not all codewords in the data frame are completely decoded, decoding the data frame according to the coding tables.
7. A decoding and error detection apparatus, comprising:
a decoding module for decoding the data frame according to coding tables;
a first determining module, coupled to the decoding module, comprising:
a remaining bit number deriving unit, arranged for obtaining a bit number of remaining un-decoded data of the data frame according to the accumulated fetched bit number;
a predetermined bit number range deriving unit, arranged for referring to the coding tables to obtain a range of predetermined bit number of data corresponding to codewords of the un-decoded data of the data frame;
a first determining unit, arranged for determining whether the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data: wherein when the bit number of the remaining un-decoded data is not within the range of the predetermined bit number of data, an error handling module performs the error handling process upon the data frame; and
the error handling module, coupling to the first determining module, wherein when the decoding module decodes a data frame of a code stream, the first determining module determines whether the data frame is erroneous according to length information of the data frame and an accumulated fetched bit number of the data frame obtained by accumulating the bit number of the decoded data of the data frame, and when the first determining module determines that the data frame is erroneous, the error handling module performs an error handling process upon the data frame.
8. The decoding and error detection apparatus of claim 7, wherein the first determining module determines whether the accumulated fetched bit number is within a length range indicated by the length information; and when the accumulated fetched bit number is not within the length range, the error handling module performs the error handling process upon the data frame.
9. The decoding and error detection apparatus of claim 7, wherein the remaining bit number deriving unit obtains the bit number of the remaining un-decoded data of the data frame according to the length information and the accumulated fetched bit number.
10. The decoding and error detection apparatus of claim 9, wherein the predetermined bit number range deriving unit obtains ranges of codeword lengths in the coding tables that are used by the codewords of the un-decoded data of the data frame, respectively; obtains the range of the predetermined bit number of the data corresponding to the codewords of the un-decoded data of the data frame according to the ranges of the codeword lengths in the coding tables that are used by the codewords of the un-decoded data; wherein the range of the predetermined bit number of the data corresponds to an accumulated summing number of the ranges of the codeword length in the coding tables that are used by the codewords of the un-decoded data.
11. The decoding and error detection apparatus of claim 7, wherein the accumulated fetched bit number further comprises a currently fetched bit number, and the first determining module further comprises:
a codeword length range deriving unit, arranged for obtaining a range of codeword lengths of codewords in the coding tables that correspond to the currently fetched bit number; and
a second determining unit, arranged for determining whether the currently fetched bit number is within the range of the codeword lengths;
wherein when second determining unit determines the currently fetched bit number is not within the range of the codeword lengths, the error handling module performs the error handling process upon the data frame.
12. The decoding and error detection apparatus of claim 7, further comprising:
a second determining module, wherein when the first determining unit determines that the bit number of the remaining un-decoded data is within the range of the predetermined bit number of data, the second determining module determines whether all codewords in the data frame are completely decoded;
wherein when the second determining module determines that not all codewords in the data frame are completely decoded, the decoding module decodes the data frame according to the coding tables.
US14/265,346 2013-05-13 2014-04-29 Error detection method of variable-length coding code stream and decoding and error detection apparatus Active 2034-08-25 US9608671B2 (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201310176084.X 2013-05-13
CN201310176084 2013-05-13
CN201310176084.XA CN103269257B (en) 2013-05-13 2013-05-13 A kind of method detecting variable-length encoding code stream mistake and decoding and error detector element

Publications (2)

Publication Number Publication Date
US20140337692A1 US20140337692A1 (en) 2014-11-13
US9608671B2 true US9608671B2 (en) 2017-03-28

Family

ID=49012869

Family Applications (1)

Application Number Title Priority Date Filing Date
US14/265,346 Active 2034-08-25 US9608671B2 (en) 2013-05-13 2014-04-29 Error detection method of variable-length coding code stream and decoding and error detection apparatus

Country Status (2)

Country Link
US (1) US9608671B2 (en)
CN (1) CN103269257B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104637543B (en) * 2014-12-10 2019-02-19 珠海艾派克微电子有限公司 Chip and the print cartridge for using the chip
CN105047200A (en) * 2015-07-21 2015-11-11 重庆邮电大学 FPGA-based FLAC hardware decoder and decoding method
US20170214413A1 (en) * 2016-01-21 2017-07-27 HGST Netherlands B.V. Joint source-channel coding with dynamic dictionary for object-based storage
WO2019227323A1 (en) * 2018-05-30 2019-12-05 深圳市大疆创新科技有限公司 Variable-length decoding method and device
CN109522262B (en) * 2018-10-10 2022-12-13 上海亚明照明有限公司 Receiving method, system, electronic terminal and storage medium suitable for indefinite length data frame
CN114051164B (en) * 2021-11-16 2022-10-25 重庆紫光华山智安科技有限公司 Decoding abnormal code stream generation method and device, electronic equipment and readable storage medium

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5603012A (en) * 1992-06-30 1997-02-11 Discovision Associates Start code detector
US5724537A (en) * 1994-03-24 1998-03-03 Discovision Associates Interface for connecting a bus to a random access memory using a two wire link
US5768561A (en) * 1992-06-30 1998-06-16 Discovision Associates Tokens-based adaptive video processing arrangement
US5805914A (en) * 1993-06-24 1998-09-08 Discovision Associates Data pipeline system and data encoding method
US5809270A (en) * 1992-06-30 1998-09-15 Discovision Associates Inverse quantizer
US5835740A (en) * 1992-06-30 1998-11-10 Discovision Associates Data pipeline system and data encoding method
US6018776A (en) * 1992-06-30 2000-01-25 Discovision Associates System for microprogrammable state machine in video parser clearing and resetting processing stages responsive to flush token generating by token generator responsive to received data
US6067417A (en) * 1992-06-30 2000-05-23 Discovision Associates Picture start token
US6079009A (en) * 1992-06-30 2000-06-20 Discovision Associates Coding standard token in a system compromising a plurality of pipeline stages
US6112017A (en) * 1992-06-30 2000-08-29 Discovision Associates Pipeline processing machine having a plurality of reconfigurable processing stages interconnected by a two-wire interface bus
US6208274B1 (en) * 1997-07-11 2001-03-27 U.S. Philips Corporation Transmission system using a variable length encoder
US6330665B1 (en) * 1992-06-30 2001-12-11 Discovision Associates Video parser
US6404817B1 (en) * 1997-11-20 2002-06-11 Lsi Logic Corporation MPEG video decoder having robust error detection and concealment
US20030156652A1 (en) * 1992-06-30 2003-08-21 Wise Adrian P. Multistandard video decoder and decompression system for processing encoded bit streams including a video formatter and methods relating thereto
US20100289674A1 (en) * 2008-03-31 2010-11-18 Panasonic Corporation Variable-length code decoding apparatus and method
US20120005562A1 (en) 2009-04-27 2012-01-05 Panasonic Corporation Encoded stream decoding device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2495878A3 (en) * 2005-05-13 2012-09-26 Qualcomm, Inc. Method and apparatus for improved multimedia decoder
US9083994B2 (en) * 2006-09-26 2015-07-14 Qualcomm Incorporated Method and system for error robust audio playback time stamp reporting
CN101494461B (en) * 2009-01-15 2011-07-20 中国科学院研究生院 Variable length symbol grade invertible encoding and decoding method for joint source and channel

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6079009A (en) * 1992-06-30 2000-06-20 Discovision Associates Coding standard token in a system compromising a plurality of pipeline stages
US5809270A (en) * 1992-06-30 1998-09-15 Discovision Associates Inverse quantizer
US5603012A (en) * 1992-06-30 1997-02-11 Discovision Associates Start code detector
US20030156652A1 (en) * 1992-06-30 2003-08-21 Wise Adrian P. Multistandard video decoder and decompression system for processing encoded bit streams including a video formatter and methods relating thereto
US6112017A (en) * 1992-06-30 2000-08-29 Discovision Associates Pipeline processing machine having a plurality of reconfigurable processing stages interconnected by a two-wire interface bus
US5835740A (en) * 1992-06-30 1998-11-10 Discovision Associates Data pipeline system and data encoding method
US6018776A (en) * 1992-06-30 2000-01-25 Discovision Associates System for microprogrammable state machine in video parser clearing and resetting processing stages responsive to flush token generating by token generator responsive to received data
US6330665B1 (en) * 1992-06-30 2001-12-11 Discovision Associates Video parser
US5768561A (en) * 1992-06-30 1998-06-16 Discovision Associates Tokens-based adaptive video processing arrangement
US6067417A (en) * 1992-06-30 2000-05-23 Discovision Associates Picture start token
US5805914A (en) * 1993-06-24 1998-09-08 Discovision Associates Data pipeline system and data encoding method
US5724537A (en) * 1994-03-24 1998-03-03 Discovision Associates Interface for connecting a bus to a random access memory using a two wire link
US6208274B1 (en) * 1997-07-11 2001-03-27 U.S. Philips Corporation Transmission system using a variable length encoder
US6404817B1 (en) * 1997-11-20 2002-06-11 Lsi Logic Corporation MPEG video decoder having robust error detection and concealment
US20100289674A1 (en) * 2008-03-31 2010-11-18 Panasonic Corporation Variable-length code decoding apparatus and method
US20120005562A1 (en) 2009-04-27 2012-01-05 Panasonic Corporation Encoded stream decoding device
CN102349272A (en) 2009-04-27 2012-02-08 松下电器产业株式会社 Coded stream decoding apparatus

Also Published As

Publication number Publication date
US20140337692A1 (en) 2014-11-13
CN103269257B (en) 2016-08-24
CN103269257A (en) 2013-08-28

Similar Documents

Publication Publication Date Title
US9608671B2 (en) Error detection method of variable-length coding code stream and decoding and error detection apparatus
US11398833B2 (en) Low-latency encoding using a bypass sub-stream and an entropy encoded sub-stream
US10587286B1 (en) Methods and devices for handling equiprobable symbols in entropy coding
US8782379B2 (en) H.264 video decoder CABAC core optimization techniques
US20100251076A1 (en) Storage controller having soft decoder included therein, related storage control method thereof and system using the same
US20140122964A1 (en) Error checking and correction method for determining an error correction code length and related error checking and correction circuit
US7965710B1 (en) Decoding operations in normal transmission mode
US20120131422A1 (en) Transmitting device, transmitting method, receiving device, receiving method, program, and transmission system
US8856625B2 (en) Transmission system, decoding device, memory controller, and memory system
US7259997B2 (en) Flash memory device with reduced access time
KR101868759B1 (en) Offset selection for error correction data
US10522155B2 (en) Pulse code modulation (PCM) data-marking
EP2127097A1 (en) Method and system for transmitting/receiving serial data in serial communication system and serial communication system for the same
US7773004B2 (en) CAVLC run-before decoding scheme
JP5542808B2 (en) Includes a method for encoding a bit amount of a data section and a corresponding decoding method, a method for encoding or decoding audio and / or video data, a method for transmitting audio and / or video data, and audio and / or video data Storage medium
JP2008108100A (en) Voice data processor
EP4224856A1 (en) Lossless compression with exponential golomb-rice coding for low-latency video transmission
US8502713B1 (en) Pipelined analog to digital converter and method for correcting a voltage offset influence thereof
US8228214B2 (en) Variable-length code decoding apparatus and method
US20070234176A1 (en) Fast decoder and method for front end of convolutionally encoded information stream
US20210058098A1 (en) Iterative Decoding Circuit and Decoding Method
JPS63305635A (en) Method and apparatus for decoding block-encoded message influenced by replacement, insertion and elimination of symbol
US12034462B2 (en) Compressing probability tables for entropy coding
KR100727896B1 (en) Method of channel coding for digital communication system and channel coding device using the same
CN115708353A (en) Signal processing method and signal processor

Legal Events

Date Code Title Description
AS Assignment

Owner name: AUTOCHIPS INC., CHINA

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:YU, JINGJIAN;REEL/FRAME:032783/0831

Effective date: 20140331

STCF Information on status: patent grant

Free format text: PATENTED CASE

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 4TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1551); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Year of fee payment: 4

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 8TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1552); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Year of fee payment: 8