A Run-length Decoding Digital Circuit

By using a state machine unit in the run-length decoding digital circuit to switch operating states according to the compressed data classification information, determine the reading timing, and use hardware decoding, the problem of low frame rate and delay caused by the high performance requirements of the MCU is solved, and efficient OSD function.

CN112600566BActive Publication Date: 2024-09-13SHANGHAI INTEGRATED CIRCUIT RESEARCH & DEVELOPMENT CENTER CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011510947.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-18
Publication Date
2024-09-13
Estimated Expiration
2040-12-18

AI Technical Summary

Technical Problem

In the existing technology, circuits that implement OSD functions through software have high requirements on MCU performance, are prone to low frame rates, are unable to output image stream data in real time, and are prone to problems such as delays, breakpoints or errors during real-time output.

Method used

Design a run-length decoding digital circuit, including a state machine unit that switches operating states according to the classification information of compressed data, determines the reading timing of the next piece of compressed data, and uses hardware to decode to ensure that the decoding speed is consistent with the input clock and solve the MCU performance requirements High question.

Benefits of technology

It realizes the overlay operation while ensuring the frame rate of the output image stream, solves the problems of low frame rate, delay, breakpoint or error, and improves the real-time and accuracy of decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112600566B
    Figure CN112600566B
Patent Text Reader

Abstract

The present invention provides a run-length decoding digital circuit, the run-length decoding digital circuit includes a state machine unit, the state machine unit switches the operation state according to the classification information of the compressed data, and the run-length decoding digital circuit determines the reading time of the next compressed data based on the operation state. With such configuration, decoding is performed in a hardware manner, which has real-time performance; at the same time, by reasonably setting the operation state and state conversion logic of the state machine unit, the coupling relationship between the decoding process of the run-length coded data itself and the waiting process required for smoothly splicing the decoded data is decoupled, the design difficulty of the run-length decoding circuit is reduced, and the interruption and delay that are easy to occur in the picture stream data output by the ordinary hardware decoding circuit are avoided, and the requirements for the picture stream data to be superimposed in the OSD function are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of digital circuit design, and in particular to a run-length decoding digital circuit. Background Art

[0002] Run-length encoding is a common compression algorithm. Its basic idea is to describe characters that are repeated and appear multiple times in succession using the format of {number of consecutive occurrences, a certain character}. In the process of run-length encoding, there are two types of data, one is the original data (also called data to be compressed or encoded), and the other is the compressed data (or encoded data). In this specification, picture stream data, decoded data, unencoded data, data in ordinary format and similar descriptions all refer to original data; data in run-length encoding format, compressed data and similar descriptions all refer to compressed data; the process of obtaining compressed data from original data is called run-length encoding; the process of obtaining original data from compressed data is called run-length decoding. A run-length decoding digital circuit provided by the present invention refers to a circuit that decodes compressed data into original picture stream data.

[0003] Run-length encoding and decoding is a solution for loading overlay images or characters to implement the OSD (picture-in-picture) function. Implementing the OSD function includes the following five steps: 1. Obtaining overlay data in run-length encoding format; 2. Obtaining the image data to be overlaid in ordinary format; 3. Decoding the overlay data in run-length encoding format to obtain decoded overlay data; 4. Superimposing the overlay data in ordinary format on the image data to be overlaid in ordinary format to obtain combined image stream data; 5. Outputting the combined image stream data.

[0004] In the prior art, the above process is implemented by MCU (Microcontroller Unit, micro control unit or microcontroller). Specifically, the MCU accesses the overlay coding information and the data to be overlaid stored in the external memory or internal cache (i.e., the above steps 1 and 2), then decodes the overlay coding information by software and combines the decoded overlay data with the data to be overlaid to complete the OSD overlay function (i.e., the above steps 3 and 4), and then writes the overlay result back to the data memory (i.e., the above step 5).

[0005] There are the following problems with decoding through MCU: Since the data reading, decoding and overlaying processes are completely based on MCU, the reading encoding and decoding speeds are limited by the MCU performance. On a lower-performance MCU, the OSD overlay frame rate may be low. Figure 1 This is a schematic diagram of an overlay error caused by MCU decoding. Figure 1It shows that there are multiple erroneous data in the YUV format image stream data finally generated by the image stream data output by the ordinary decoding circuit, which affects the final overlay effect.

[0006] In summary, in the prior art, the circuit that implements the OSD function through software has high requirements on the MCU performance, and is prone to low frame rate, inability to output picture stream data in real time, and delays, breakpoints or errors when outputting picture stream data in real time. Summary of the invention

[0007] The purpose of the present invention is to provide a run-length decoding digital circuit to solve the problems in the prior art that the circuit that realizes the OSD function by software has high requirements on MCU performance and is prone to low frame rate, inability to output picture stream data in real time, and delays, breakpoints or errors when outputting picture stream data in real time.

[0008] In order to solve the above technical problems, the present invention provides a run-length decoding digital circuit, which includes a state machine unit, which switches the operating state according to the classification information of the compressed data, and the run-length decoding digital circuit determines the reading time of the next compressed data based on the operating state; the compressed data is picture stream data in a run-length compression format.

[0009] Optionally, the run-length decoding digital circuit includes a decoding unit, which is used to obtain the classification information of the compressed data and send the classification information to the state machine unit; the decoding unit is also used to decode the compressed data.

[0010] Optionally, the classification information includes the compression type of the compressed data, the length of the compressed data itself, and the length of the decoded data.

[0011] Optionally, the running state includes a ready state and a working state, the working state includes a core state, and when the compression type of the compressed data is uncompressed, its own length is 1 byte, and the length of the decoded data is 1 byte, the running state switches to the core state.

[0012] Optionally, after the current decoding process of the compressed data is completed, if the state machine unit determines that the run-length decoding digital circuit needs to continue working, the operating state is switched to the core state.

[0013] Optionally, the working state also includes a first state group, which includes at least one of the working states; when the compression type of the compressed data is uncompressed and its own length is at least 2 bytes, the running state is switched to one or more of the working states in the first state group according to the first state switching logic.

[0014] Optionally, the first state switching logic includes: when the length of the compressed data itself is 2 bytes and the length of the decoded data is 2 bytes, the running state is switched to one of the working states in the first state group; and when the length of the compressed data itself is 2 bytes and the length of the decoded data is 3 bytes, the running state is switched to one of the working states in the first state group.

[0015] Optionally, the first state switching logic includes: when the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an odd number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group; and when the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an even number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group.

[0016] Optionally, the working state also includes a second state group, which includes at least one of the working states; when the compression type of the compressed data is compression, the running state is switched to one or more of the working states in the second state group according to the second state switching logic.

[0017] Optionally, the second state switching logic includes: when the length of the compressed data itself is 2 bytes and the length of the decoded data is between 3 and 1023 bytes, the running state is switched to one of the working states in the second state group.

[0018] Optionally, the second state switching logic includes, when the length of the compressed data itself is 3 bytes and the length of the decoded data is between 1024 and (2^26-1) bytes, the running state is switched to one of the working states in the second state group.

[0019] Optionally, the ready state includes a waiting state and an on state; when the state machine unit has not started working, the running state is switched to the waiting state; when the running state is the waiting state, the state machine unit receives an end signal of the previous frame and an enable signal, the running state is switched to the on state; and after the running state is the on state, it waits for a preset number of clock cycles, and the running state is switched to the core state.

[0020] Optionally, the run-length decoding digital circuit includes at least one of the following elements or units: a memory, which is used to store the compressed data to be decoded, and the compressed data used by the state machine unit is read from the memory; a read control unit, which is used to read the compressed data according to the operating state and send it to a subsequent circuit; and a picture stream data memory, which is used to cache the decoded picture stream data and output the decoded picture stream data to an external circuit.

[0021] Compared with the prior art, the run-length decoding digital circuit provided by the present invention includes a state machine unit, the state machine unit switches the operating state according to the classification information of the compressed data, and the run-length decoding digital circuit determines the reading time of the next compressed data based on the operating state. Decoding is performed in hardware, which is real-time, and the decoding speed is completely consistent with the input clock. The overlay operation can be completed while ensuring the output picture stream frame rate, which solves the problem that the circuit that realizes the OSD function by software has high requirements on MCU performance, and is prone to low frame rate, inability to output picture stream data in real time, and delays, breakpoints or errors when outputting picture stream data in real time. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Those skilled in the art will appreciate that the accompanying drawings are provided for a better understanding of the present invention and do not constitute any limitation on the scope of the present invention.

[0023] Figure 1 Schematic diagram of the error caused by overlay when the OSD function is implemented for MCU;

[0024] Figure 2 A schematic diagram of the structure of a run-length decoding digital circuit according to an embodiment of the present invention;

[0025] Figure 3 A schematic diagram of data types of part of compressed data according to an embodiment of the present invention;

[0026] Figure 4 A schematic diagram of the operating state and state transition logic of a state machine unit according to an embodiment of the present invention;

[0027] Figure 5It is a schematic diagram of correct superimposed data obtained by an OSD circuit according to an embodiment of the present invention.

[0028] In the attached figure:

[0029] 1-state machine unit; 2-decoding unit; 3-memory; 4-reading control unit; 5-picture stream data memory. DETAILED DESCRIPTION

[0030] In order to make the purpose, advantages and features of the present invention clearer, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the drawings are all in a very simplified form and are not drawn to scale, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In addition, the structure shown in the drawings is often a part of the actual structure. In particular, the emphasis of each drawing is different, and sometimes different scales are used.

[0031] As used in the present invention, the singular forms "a", "an" and "the" include plural objects, the term "or" is generally used in a sense including "and / or", the term "several" is generally used in a sense including "at least one", and the term "at least two" is generally used in a sense including "two or more". In addition, the terms "first", "second" and "third" are used for descriptive purposes only and cannot be understood as indicating or suggesting relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first", "second", and "third" may explicitly or implicitly include one or at least two of the features. The term "proximal end" is usually the end close to the operator, and the term "distal end" is usually the end close to the patient. "One end" and "the other end" as well as "proximal end" and "distal end" usually refer to two corresponding parts, which include not only the endpoints. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral body; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal connection of the two elements or the interaction relationship between the two elements. In addition, as used in the present invention, an element is arranged on another element, which usually only means that there is a connection, coupling, matching or transmission relationship between the two elements, and the connection, coupling, matching or transmission between the two elements can be direct or indirect through an intermediate element, and it cannot be understood as indicating or implying the spatial position relationship between the two elements, that is, one element can be in any position such as inside, outside, above, below or on one side of another element, unless the content clearly indicates otherwise. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0032] The core idea of ​​the present invention is to provide a run-length decoding digital circuit to solve the problems in the prior art that the circuit that realizes the OSD function by software has high requirements on MCU performance, is prone to low frame rate, cannot output picture stream data in real time, and is prone to delays, breakpoints or errors when outputting picture stream data in real time.

[0033] In the background technology section, the disadvantages of implementing the OSD function through MCU have been analyzed in detail. Further, the inventors found that since the run-length coded data contains multiple data types, and the lengths of the run-length coded data of different data types are also different, the delays required to wait for the run-length coded data of different data types before and after reading, during decoding, and after decoding are different, and cannot be processed with a simple logic, otherwise it is easy to cause data errors or loss during the decoding process, and cause erroneous data or breakpoints in the final spliced ​​picture stream data. Therefore, ordinary hardware decoding circuits have difficulties in splicing the picture stream data after decoding the continuous run-length coded data of different data types. In order to realize the OSD function, a decoding circuit is required to output the picture stream to be superimposed, and the picture stream output by the decoding circuit and the picture stream input data of another channel must be strictly superimposed according to the user's configuration, the size of the superimposed area, etc., and there must be no signal interruption and delay of the picture stream data in the middle. The hardware decoding circuit with a simple setting cannot meet the above requirements. Therefore, the inventors further thought that the above difficulties can be solved by the run-length decoding digital circuit in this embodiment.

[0034] The following description is given with reference to the accompanying drawings.

[0035] Please refer to Figures 2 to 5 ,in, Figure 2 A schematic diagram of the structure of a run-length decoding digital circuit according to an embodiment of the present invention; Figure 3 A schematic diagram of data types of part of compressed data according to an embodiment of the present invention; Figure 4 A schematic diagram of the operating state and state transition logic of a state machine unit according to an embodiment of the present invention; Figure 5 It is a schematic diagram of correct superimposed data obtained by an OSD circuit according to an embodiment of the present invention.

[0036] like Figure 2 As shown, this embodiment provides a run-length decoding digital circuit, which includes a state machine unit 1. The state machine unit 1 switches the operating state according to the classification information of the compressed data. The run-length decoding digital circuit determines the reading time of the next compressed data based on the operating state; the compressed data is picture stream data in a run-length compression format.

[0037] With such configuration, on the one hand, decoding is performed in hardware mode, which is real-time, and the decoding speed is completely consistent with the input clock. The overlay operation can be completed while ensuring the frame rate of the output picture stream, which solves the problem that the circuit that realizes the OSD function by software mode has high requirements on MCU performance, and is prone to low frame rate, inability to output picture stream data in real time, and delays, breakpoints or errors when outputting picture stream data in real time. On the other hand, by reasonably setting the running state and state conversion logic of the state machine unit 1, the units related to decoding and the units related to reading the compressed data to be decoded in the run-length decoding digital circuit can perform their respective duties, and the final decoded data can be correctly spliced ​​without the need to cooperate with each other. In other words, the setting of the state machine unit 1 decouples the coupling relationship between the decoding process of the run-length coded data itself and the delay time setting for reading the decoded data, reduces the design difficulty of the run-length decoding circuit, and solves the problem that the ordinary hardware decoding circuit is difficult to adapt to run-length coded data of different data types during the decoding process, thereby causing errors, delays or breakpoints in the spliced ​​picture stream data, and cannot meet the requirements of the picture stream data to be superimposed in the OSD function.

[0038] Please continue to refer to Figure 2 In an exemplary embodiment, the run-length decoding digital circuit includes a decoding unit 2, a memory 3, a read control unit 4, and a picture stream data memory 5.

[0039] The decoding unit 2 is used to obtain the classification information of the compressed data and send the classification information to the state machine unit 1; the decoding unit 2 is also used to decode the compressed data. The function of obtaining the classification information is set in the decoding unit 2, so that the decoding circuit inside the decoding unit can be better reused, reducing the scale and size of the entire circuit.

[0040] The memory 3 is used to store the compressed data to be decoded, and the compressed data used by the state machine unit 1 is read from the memory 3. Such a configuration can make it more convenient for the decoding unit 2 to obtain the compressed data. Preferably, the memory 3 is a static random access memory (i.e., SRAM). In other embodiments, as long as it can ensure that the compressed data can be read continuously, other forms of memory, such as ROM (Read-Only Memory) and the like, can also be selected.

[0041] The read control unit 4 is used to read the compressed data according to the running state and send it to the subsequent circuit. Using a separate read control unit 4 to control the timing of reading data makes the division of labor between the various modules of the circuit clearer and reduces the difficulty of circuit design.

[0042] The picture stream data memory 5 is used to cache the decoded picture stream data and output the decoded picture stream data to the external circuit. Setting the picture stream data memory 5 can further buffer the data, thereby further ensuring the accuracy of the output overlay information. The picture stream data memory 5 can also process data in a first-in-first-out manner, and can pause caching data when the available storage space is less than or equal to a preset ratio. When the picture stream data memory 5 pauses caching data, other parts of the run-length decoding digital circuit must also change the current working state accordingly. The specific change rules and logic can be configured according to common knowledge in the field, and will not be described in detail here. The preset ratio can be 1 / 4, 1 / 2 or other suitable ratios.

[0043] It should be understood that in other embodiments, the memory 3, the read control unit 4, and the image stream data memory 5 can also be selectively set. Such a solution can still adapt to run-length encoded data of different data types. However, the solution of setting the above-mentioned elements or units at the same time is a better solution.

[0044] Please refer to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of data types of part of compressed data according to an embodiment of the present invention. Figure 3 It can be seen that the data types of the compressed data are various, so it is necessary to set detailed classification rules to classify the compressed data so as to better perform subsequent state conversion.

[0045] Preferably, the classification information includes the compression type of the compressed data, the length of the compressed data itself, and the length of the decoded data. The compression type of the compressed data determines the speed of data decoding, the length of the compressed data itself determines the time for data reading, and the length of the decoded data determines the time required for data output. The three together determine the total time required from reading a new compressed data to outputting the decoded data of the compressed data (hereinafter, "decoding time" is used to replace this time, but please note the subtle difference between "decoding time" and this time). Based on this time, the following problem analysis can be performed: With the goal that the decoded data of the second compressed data can be output just in time with the decoded data of the first compressed data, how many clock cycles should the reading time of the second compressed data be away from the reading time of the first compressed data? The result of the above problem can be obtained by advance calculation or experiment, and the calculation result can be used to guide the operation of the run-length decoding digital circuit, thereby solving the problem of difficulty in splicing between data in the prior art. Therefore, selecting the above three indicators as the classification information of the compressed data can make the decoding time of the data in the same classification similar or equal, which is conducive to the subsequent logic planning. It should be particularly noted that according to the existing run-length coding standard, the compressed data must contain a 2-bit flag bit and several bit length indicator bits, and the above indicators can be obtained through the flag bit and length indicator bit of the compressed data. However, in order to facilitate understanding and adapt to possible future modifications of the run-length coding standard, the subsequent content of this specification is described with the specific content of the above three indicators, without involving the concept of flag bit and length indicator bit.

[0046] According to the classification information, multiple classifications can be designed and correspond to corresponding operating states. The following content of the specification introduces the specific details of the operating state by alternately explaining the design ideas and embodiments. For the embodiments, please refer to Figure 4 .

[0047] First, the running state includes a ready state and a working state. Such a configuration is conducive to the state machine unit 1 to better switch between the standby and working states. The ready state includes a waiting state and an on state; when the state machine unit 1 has not started working, the running state switches to the waiting state; when the running state is the waiting state, the state machine unit 1 receives the end signal of the previous frame and receives the enable signal, the running state switches to the on state; and, after the running state is the on state, wait for three clock cycles, and the running state switches to the core state. The physical input terminals of the end signal and the enable signal and the corresponding processing logic can be set according to the common knowledge in the field, and will not be introduced in detail here. In this embodiment, the corresponding states are also named waiting state and on state, please refer to Figure 4 It should be understood that in this embodiment, the transition between the on state and the core state requires waiting for three clock cycles, and in other embodiments, it can also be set to wait for a preset number of clock cycles according to actual needs and operating parameters of other modules of the circuit, and the preset number can be any natural number.

[0048] Secondly, when the compression type of the compressed data is uncompressed, the length of the compressed data itself is 1 byte, and the length of the decoded data is 1 byte (hereinafter referred to as classification condition 1), the decoding time of the data is short. If the connection relationship with the previous data and the connection relationship with the next data are not processed well within the decoding time, the final output data is likely to be wrong. Therefore, it is necessary to focus on processing the data that meets the classification condition 1. Therefore, it is necessary to design the working state to include the core state. When the compressed data meets the classification condition 1, the running state switches to the core state. In this embodiment, PT1 corresponds to the core state.

[0049] In order to further solve the problem that the processing of data that meets classification condition one is prone to errors, after the current decoding process of the compressed data is completed, the state machine unit 1 switches the operating state to the core state if it is determined that the run-length decoding digital circuit needs to continue working. The above design idea can be regarded as a form of "prejudgment" logic. Although the state machine unit does not know which category the next compressed data belongs to at this time, it is a better strategy to prejudge it as classification condition one. If the compressed data of the next item does meet classification condition one, the run-length decoding digital circuit can start working immediately. If the compressed data of the next item does not meet classification condition one, another switch is performed. Although this switch consumes a certain number of clock cycles, since the decoding time of compressed data of other categories is longer, the consumption here will not affect the final result. Please refer to Figure 4 , Figure 4 In the state PT2, PT3, CPT1, CPT2, PTEVEN and PTODD, there are arrows pointing to PT1, that is to say, the above working states will switch to PT1 after the end. It should be understood that only when the state machine unit 1 determines that the stroke decoding digital circuit needs to continue to work, the operating state will switch to the core state, otherwise, it may also switch to the standby state. The specific conditions for switching to the standby state can be set according to actual needs, for example, the signal of the enable end disappears or other conversion conditions. This logic is not the focus of this specification and will not be expanded here. It should be understood that in some other embodiments, some working states may not set the state transition path to switch to the standby state.

[0050] The inventors conducted a systematic analysis of the remaining possible data types and enumerated them in an exhaustive manner using a classification approach. The exhaustive results are shown in Table 1.

[0051] Table 1 Classification results of data types

[0052]

[0053]

[0054] It should be understood that the classification method in Table 1 is a possible exhaustive method, not just one classification idea. Due to the length of the article, the classification conditions in Table 1 are divided into nine categories for the purpose of illustrating the classification ideas. In fact, some conditions can be further subdivided according to the same idea. For example, classification condition six can be further subdivided into two subcategories: odd numbers between 1024 and (2^26-1) and odd numbers ≥2^26. The odd number ≥2^26 subcategory can be further subdivided. In order to avoid being verbose, it will not be further expanded here.

[0055] The discussion is based on the classification conditions shown in Table 1. (Please understand other classification methods in the same way.) First, in the classification conditions listed in Table 1, the compressed data of adjacent conditions often have similar logic when processing, but they are different; secondly, the number of operating state settings should also be considered. Too few will not be able to play the advantages of the state machine, and too many will increase the cost of design and manufacturing. Based on the comprehensive consideration of the above two design ideas, the following design ideas are obtained:

[0056] The working state also includes a first state group, which includes at least one working state; when the compression type of the compressed data is uncompressed and its length is at least 2 bytes, the operating state switches to one or more working states in the first state group according to the first state switching logic. For example, one working state can be set for all situations that meet classification conditions 2 to 7, or one working state can be set for each situation that meets classification conditions 2 to 7, or one working state can be set for situations that meet classification conditions 2 to 3, and another working state can be set for situations that meet classification conditions 4 to 7.

[0057] The working state also includes a second state group, and the second state group includes at least one of the working states; when the compression type of the compressed data is compression, the running state is switched to one or more of the working states in the second state group according to the second state switching logic. The specific setting ideas of the second state group can be understood by referring to the examples of the first state group in this specification.

[0058] Preferably, the first state switching logic includes: when the length of the compressed data itself is 2 bytes and the length of the decoded data is 2 bytes, the running state is switched to one of the working states in the first state group; and when the length of the compressed data itself is 2 bytes and the length of the decoded data is 3 bytes, the running state is switched to one of the working states in the first state group; and when the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an odd number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group; and when the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an even number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group.

[0059] The second state switching logic includes: when the length of the compressed data itself is 2 bytes and the length of the decoded data is between 3 and 1023 bytes, the running state is switched to one of the working states in the second state group; and when the length of the compressed data itself is 3 bytes and the length of the decoded data is between 1024 and (2^26-1) bytes, the running state is switched to one of the working states in the second state group.

[0060] It should be understood that the concept of "one working state" in the above design ideas should be understood as follows: "one working state" corresponding to different classification conditions in the same state group can actually be the same working state, or different working states, or part of them can be the same working state, and the other parts can be other working states. The specific setting scheme can be weighed according to actual needs and the design and manufacturing costs of the circuit.

[0061] For the classification situations not mentioned in the above design ideas, one other working state can be designed for the remaining situations according to actual needs (only for the same state group, it is not recommended to merge the working states of different state groups), or the remaining situations can be classified into an existing working state, or subdivided, with multiple different working states corresponding one-to-one to the remaining situations after subdivision.

[0062] In an exemplary embodiment, please refer to Figure 4 When the compressed data meets the classification condition two, the working state is switched to PT2; when the compressed data meets the classification condition three, the working state is switched to PT3; when the compressed data meets the classification condition four or classification condition six, the working state is switched to PTODD; when the compressed data meets the classification condition five or classification condition seven, the working state is switched to PTEVEN; when the compressed data meets the classification condition eight, the working state is switched to CPT1; when the compressed data meets the classification condition nine or classification condition ten, the working state is switched to CPT2.

[0063] It should be understood that based on the detailed description of the above design ideas in this specification, and with the help of Table 1 to judge the degree of similarity of the processing logic between the classification conditions, technical personnel in this field can easily split or combine the above classification conditions two to ten, and design corresponding working states, and obtain other better working state setting schemes for the state machine unit 1.

[0064] In addition, although a solution such as setting an independent state for classification condition two plus classification condition ten will have a negative impact on the design and manufacture of the stroke decoding digital circuit, such a solution can still solve the problems caused by using software for decoding in the prior art and should also be regarded as a simple change to this embodiment.

[0065] It should be understood that when the operating state is determined, the reading timing of the next compressed data corresponding to each operating state can be configured according to the specific situation. For example, after the other parameters of the circuit are determined, the better reading timing is obtained by calculation or experimental method, and then the reading timing is configured in the run-length decoding digital circuit.

[0066] As described in the background art, the realization of the OSD function includes five steps. The run-length decoding digital circuit disclosed in this embodiment optimizes step 3 of the five steps and realizes the functions of step 1 and step 3.

[0067] This embodiment also provides an OSD circuit for realizing a complete OSD function, wherein the OSD circuit includes the above-mentioned run-length decoding digital circuit and overlay module, wherein the overlay module is configured to receive the decoded first picture stream data sent by the run-length decoding digital circuit, and receive the second picture stream data, and superimpose the first picture stream data and the second picture stream data according to the overlay logic to obtain the overlay picture stream data. The other modules of the OSD circuit, the internal specific implementation of the overlay module, and the connection relationship between the modules of the OSD circuit can be set by those skilled in the art according to common knowledge, and will not be described in detail here. Please refer to Figure 5 In one embodiment, the video data in YUV format output by the OSD circuit is as follows: Figure 5 As shown, it can be seen that the OSD circuit overcomes the problem that ordinary decoding circuits have difficulty in splicing different types of data.

[0068] In summary, the run-length decoding digital circuit provided by the present invention includes a state machine unit 1, the state machine unit 1 switches the operating state according to the classification information of the compressed data, and the run-length decoding digital circuit determines the reading time of the next compressed data based on the operating state. Decoding is performed in hardware, which has real-time performance; at the same time, by reasonably setting the operating state and state conversion logic of the state machine unit 1, the problem of difficulty in splicing different types of data in ordinary decoding circuits is overcome.

[0069] The above description is only a description of the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the technical solution of the present invention.

Claims

1. A run-length decoding digital circuit, It is characterized in that The run-length decoding digital circuit includes a state machine unit, the state machine unit switches the operation state according to the classification information of the compressed data, and the run-length decoding digital circuit determines the reading time of the next compressed data based on the operation state; the compressed data is picture stream data in the run-length compression format; The classification information includes the compression type of the compressed data, the length of the compressed data itself, and the length of the decoded data; The running state includes a ready state and a working state, the working state includes a core state, and the ready state includes a waiting state and a start state; When the state machine unit does not start working, the running state is switched to the waiting state; When the running state is the waiting state, and the state machine unit receives an end signal of the previous frame and an enable signal, the running state is switched to the on state; as well as When the running state is the on state, a preset number of clock cycles are waited for, and the running state is switched to the core state.

2. The run-length decoding digital circuit according to claim 1, It is characterized in that The run-length decoding digital circuit includes a decoding unit, which is used to obtain the classification information of the compressed data and send the classification information to the state machine unit; the decoding unit is also used to decode the compressed data.

3. The run-length decoding digital circuit according to claim 1, It is characterized in that When the compression type of the compressed data is uncompressed, the length of the compressed data is 1 byte, and the length of the decoded data is 1 byte, the running state is switched to the core state.

4. The run-length decoding digital circuit according to claim 3, It is characterized in that After the current decoding process of the compressed data is completed, if the state machine unit determines that the run-length decoding digital circuit needs to continue working, the operating state is switched to the core state.

5. The run-length decoding digital circuit according to claim 3, It is characterized in that The working state further comprises a first state group, wherein the first state group comprises at least one of the working states; When the compression type of the compressed data is uncompressed and the length of the compressed data is at least 2 bytes, the running state is switched to one or more working states in the first state group according to the first state switching logic.

6. The run-length decoding digital circuit according to claim 5, It is characterized in that The first state switching logic includes: When the length of the compressed data itself is 2 bytes and the length of the decoded data is 2 bytes, the running state is switched to one of the working states in the first state group; and When the length of the compressed data itself is 2 bytes and the length of the decoded data is 3 bytes, the running state is switched to one of the working states in the first state group.

7. The run-length decoding digital circuit according to claim 6, It is characterized in that The first state switching logic includes: When the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an odd number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group; and When the length of the compressed data itself is at least 3 bytes and the length of the decoded data is an even number of bytes between 4 and 1023, the running state is switched to one of the working states in the first state group.

8. The run-length decoding digital circuit according to claim 3, It is characterized in that The working state further includes a second state group, wherein the second state group includes at least one of the working states; When the compression type of the compressed data is compression, the running state is switched to one or more working states in the second state group according to the second state switching logic.

9. The run-length decoding digital circuit according to claim 8, It is characterized in that The second state switching logic includes: When the length of the compressed data itself is 2 bytes and the length of the decoded data is between 3 and 1023 bytes, the running state is switched to one of the working states in the second state group.

10. The run-length decoding digital circuit according to claim 9, It is characterized in that The second state switching logic includes: When the length of the compressed data itself is 3 bytes and the length of the decoded data is between 1024 and (2^26-1) bytes, the running state is switched to one of the working states in the second state group.

11. The run-length decoding digital circuit according to claim 1, It is characterized in that The device comprises at least one of the following elements or units: a memory, the memory being used to store the compressed data to be decoded, the compressed data used by the state machine unit being read from the memory; A reading control unit, the reading control unit is used to read the compressed data according to the operating state and send it to a subsequent circuit; as well as A picture stream data memory is used to cache the decoded picture stream data and output the decoded picture stream data to an external circuit.