An encoding method, apparatus, device and readable storage medium
By setting the buffer flip pointer and tail pointer in the encoder, and performing a flip operation on the bitstream based on the overflow flag information, the bitsOutstanding problem in CABAC encoding is solved, and stable storage and overflow handling of the bitstream are achieved.
Patent Information
- Application Number
- CN202310102345.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-02-10
AI Technical Summary
The CABAC encoding has a bitOutstanding problem, which causes the binary code stream of the next clock cycle to overflow and affect the code stream of the previous clock cycle. The flipping problem needs to be solved.
A buffer is set up in the encoder, and a toggle pointer and a tail pointer are set in the buffer. The toggle operation is performed on the bitstream to be toggle according to the overflow flag information in the description information, the stored bitstream is updated, and the toggle pointer is ensured to point to the least significant 0 element and the tail pointer to the last element.
It effectively solves the bitouting problem of CABAC encoding, ensures that the bit stream is flipped when it overflows, avoids the impact of overflow, simplifies hardware overhead and reduces the complexity of the scheme.
Smart Images

Figure CN116112670B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to an encoding method, device, equipment and readable storage medium. BACKGROUND
[0002] At present, the binary code stream of the previous clock cycle based on CABAC (Context-based Adaptive Binary Arithmatic Coding) will be affected by the binary code stream of the next clock cycle. If the binary code stream of the next clock cycle has overflow, the elements in the binary code stream of the previous clock cycle need to be flipped. This situation is called bitsOutstanding problem of CABAC encoding.
[0003] Therefore, how to solve the bitsOutstanding problem of CABAC encoding is a problem to be solved by those skilled in the art. SUMMARY
[0004] Therefore, the purpose of the present application is to provide an encoding method, device, equipment and readable storage medium to solve the bitsOutstanding problem of CABAC encoding. The specific scheme is as follows:
[0005] In a first aspect, the present application provides an encoding method applied to an encoder, wherein the encoder comprises a buffer area, the buffer area is provided with a flip pointer and a tail pointer, the flip pointer points to the lowest 0 element in the current stored code stream in the buffer area, and the tail pointer points to the last element in the current stored code stream, wherein the code stream between the flip pointer and the tail pointer is a to-be-flipped code stream, and the method comprises:
[0006] receiving a current input code stream and description information of the current input code stream;
[0007] performing a flip operation on the to-be-flipped code stream according to overflow identification information in the description information to obtain a target code stream;
[0008] storing the current input code stream to the buffer area to obtain an updated stored code stream, wherein the flip pointer points to the lowest 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
[0009] Optionally, the flip operation on the to-be-flipped code stream according to the overflow identification information in the description information to obtain a target code stream comprises:
[0010] According to the overflow identification information, all element values in the to-be-inverted code stream are negated to obtain the target code stream.
[0011] Optionally, the method further comprises:
[0012] According to non-overflow identification information in the description information, all element values in the to-be-inverted code stream remain unchanged to obtain the target code stream.
[0013] Optionally, the description information further comprises: a code stream length of the current input code stream.
[0014] Correspondingly, the storing of the current input code stream into the cache area comprises:
[0015] determining whether the remaining space of the cache area is not less than the code stream length;
[0016] If the remaining space is not less than the code stream length, a storage address pointed to by the tail pointer is obtained, a next address of the storage address is taken as an initial storage address of the current input code stream, and the current input code stream is stored into the cache area starting from the initial storage address.
[0017] If the remaining space is less than the code stream length, output of elements before a lowest bit 0 element in the target code stream is waited, and according to an element output result, the elements not output are sequentially moved and stored into storage space occupied by the output elements in the cache area, until the remaining space is not less than the code stream length, the current input code stream is stored into the cache area.
[0018] Optionally, the description information further comprises: position record information of the lowest bit 0 element in the current input code stream.
[0019] Correspondingly, if the position record information is not default invalid information, it is determined that the current input code stream is not a full 1 code stream; otherwise, it is determined that the current input code stream is a full 1 code stream.
[0020] Optionally, the method further comprises:
[0021] receiving a code stream output signal, and according to the code stream output signal, storing elements in a previous address of the address pointed to by the inversion pointer as determined code stream output.
[0022] Optionally, the method further comprises:
[0023] If a code stream termination signal is received, data stored in the address pointed to by the tail pointer and a previous address thereof are taken as determined code stream output.
[0024] In a second aspect, the present application provides an encoding device applied to an encoder, wherein the encoder comprises a buffer area, the buffer area is provided with a flip pointer and a tail pointer, the flip pointer points to the lowest bit 0 element in a current stored code stream in the buffer area, and the tail pointer points to the last element in the current stored code stream, wherein the code stream between the flip pointer and the tail pointer is a to-be-flipped code stream, and the device comprises:
[0025] a receiving module configured to receive a current input code stream and description information of the current input code stream;
[0026] a flipping module configured to perform a flipping operation on the to-be-flipped code stream according to overflow identification information in the description information to obtain a target code stream;
[0027] a storage module configured to store the current input code stream into the buffer area to obtain an updated stored code stream, wherein the flip pointer points to the lowest bit 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
[0028] In a third aspect, the present application provides an electronic device, comprising:
[0029] a memory configured to store a computer program;
[0030] a processor configured to execute the computer program to implement the encoding method disclosed above.
[0031] In a fourth aspect, the present application provides a readable storage medium configured to store a computer program, wherein the computer program is executed by a processor to implement the encoding method disclosed above.
[0032] According to the above scheme, the present application provides an encoding method applied to an encoder, wherein the encoder comprises a buffer area, the buffer area is provided with a flip pointer and a tail pointer, the flip pointer points to the lowest bit 0 element in a current stored code stream in the buffer area, and the tail pointer points to the last element in the current stored code stream, wherein the code stream between the flip pointer and the tail pointer is a to-be-flipped code stream, and the method comprises the following steps: receiving a current input code stream and description information of the current input code stream; performing a flipping operation on the to-be-flipped code stream according to overflow identification information in the description information to obtain a target code stream; and storing the current input code stream into the buffer area to obtain an updated stored code stream, wherein the flip pointer points to the lowest bit 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
[0033] It can be seen that the application is provided with a buffer area in the encoder, and a flip pointer and a tail pointer are arranged in the buffer area, the flip pointer points to the lowest bit 0 element in the current stored code stream in the buffer area, and the tail pointer points to the last element in the current stored code stream in the buffer area. Since the code stream after the CABAC encoding period may overflow, the code stream between the flip pointer and the tail pointer may be flipped due to the overflow of the code stream after the period, and the code stream between the flip pointer and the tail pointer is the to-be-flipped code stream. Accordingly, after receiving the current input code stream (such as the next period code stream of the current stored code stream) and the description information of the current input code stream, the application flips the to-be-flipped code stream according to the overflow identification information in the description information to obtain a target code stream; the current input code stream is stored in the buffer area to obtain an updated stored code stream, and then the flip pointer points to the lowest bit 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream. Therefore, when the current input code stream overflows later, all elements between the lowest bit 0 element and the last element in the current stored code stream are flipped first to solve the overflow problem caused by the new input code stream.
[0034] Correspondingly, the application provides an encoding device, equipment and readable storage medium, which also have the above technical effects. BRIEF DESCRIPTION OF DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of the provided drawings.
[0036] Figure 1 A flow chart of an encoding method disclosed by the application;
[0037] Figure 2 A code stream storage position schematic diagram disclosed by the application;
[0038] Figure 3 A CABAC encoding process schematic diagram disclosed by the application;
[0039] Figure 4 A buffer area structure and input signal schematic diagram disclosed by the application;
[0040] Figure 5 A pointer schematic diagram disclosed by the application;
[0041] Figure 6 An encoding device schematic diagram disclosed by the application;
[0042] Figure 7A schematic diagram of an electronic device is disclosed in the present application. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0044] To solve the bitsOutstanding problem of CABAC encoding, the present application provides an encoding scheme which can effectively solve the bitsOutstanding problem of CABAC encoding.
[0045] Referring to Figure 1 As shown in the figure, the present embodiment discloses an encoding method applied to an encoder, the encoder comprising a buffer area, the buffer area being provided with a flip pointer and a tail pointer, the flip pointer pointing to the lowest 0 element in the current stored code stream in the buffer area, and the tail pointer pointing to the last element in the current stored code stream, wherein the code stream between the flip pointer and the tail pointer is a to-be-flipped code stream, and the method comprises:
[0046] S101, receiving a current input code stream and description information of the current input code stream.
[0047] It should be noted that the current input code stream and the current stored code stream in the buffer area are binary encrypted bit streams obtained based on CABAC encoding. CABAC encoding mainly comprises: loading the context syntax information to be encoded into a buffer, then sorting the syntax information according to a predetermined protocol (such as 266 protocol), and converting the sorted syntax information into a binary sequence by using CABAC encoding mode, and then selecting a suitable probability model according to the predetermined protocol to encrypt the binary sequence, thereby obtaining a binary encrypted bit stream. The present embodiment inputs these binary encrypted bit streams into the buffer area in the encoder in cycles, so as to solve the bitsOutstanding problem of CABAC encoding by using the two pointers set in the buffer area. After the last code stream is input into the buffer area, a code stream termination signal can be used to inform the buffer area that the current code stream has ended.
[0048] The description information of the current input code stream comprises: the code stream length of the current input code stream, overflow identification information corresponding to the current input code stream, and position record information of the lowest 0 element in the current input code stream. If the current input code stream is a full 1 code stream, the position record information of the lowest 0 element in the current input code stream is default invalid information; otherwise, the position record information of the lowest 0 element in the current input code stream is the position of the lowest 0 element in the current input code stream.
[0049] In a specific embodiment, the description information of the current input code stream includes overflow identification information corresponding to the current input code stream.
[0050] S102, according to the overflow identification information in the description information, performing a flip operation on the code stream to be flipped to obtain a target code stream.
[0051] S103, storing the current input code stream to the cache area to obtain an updated stored code stream, wherein the flip pointer points to the lowest 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
[0052] In this embodiment, the tail pointer points to the last element in the current stored code stream, that is, the tail pointer points to the storage address of the last element in the current stored code stream in the cache area; and the current input code stream and the current stored code stream are both binary encrypted bit streams obtained based on CABAC encoding. Therefore, the current stored code stream is earlier than the current input code stream inputting the cache area, and the current stored code stream can be the last period code stream of the current input code stream, or the code stream of the previous several periods of the current input code stream. It can be seen that the time period of the current input code stream is later than that of the current stored code stream.
[0053] It should be noted that the flip pointer always points to the lowest 0 element of the stored code stream, and the tail pointer always points to the last element of the stored code stream; and the processing object of the flip operation is always the elements between the addresses pointed by the two pointers, and includes the elements pointed by the two pointers.
[0054] In a specific embodiment, according to the overflow identification information in the description information, performing a flip operation on the code stream to be flipped to obtain a target code stream, including: according to the overflow identification information, performing a NOT operation on all element values in the code stream to be flipped to obtain the target code stream. That is, when the current input code stream overflows, the elements stored in the address pointed by the flip pointer to the address pointed by the tail pointer will be flipped due to the overflow of the current input code stream, so the values of the lowest 0 element and all elements after it in the current stored code stream can be negated according to the flip pointer and the tail pointer to complete the flip operation on the code stream to be flipped.
[0055] For example, if the code stream input into the cache area in the first period (i.e. the current stored code stream) is 101, then after 101 is stored in the cache area, the flip pointer points to the address of the 0 element in 101, and the tail pointer points to the address of the last element 1 in 101. If the code stream input in the second period is 111, and 111 corresponds to overflow identification information, then 01 in the first period code stream 101 is the code stream to be flipped, at this time, the code stream to be flipped 01 is flipped, like Figure 2As shown, after the first period code stream 101 is flipped to 110, the second period code stream 111 is stored from the next address of 110, and the updated stored code stream 110111 is obtained. At this time, the flip pointer points to the lowest bit 0 element in the code stream 110111, and the tail pointer points to the last element 1 in the code stream 110111.
[0056] For example, if the first period code stream A is 011011, since the first period code stream cannot overflow, the code stream is directly stored after reaching the buffer area; after storage, the flip pointer points to the storage address of the lowest bit 0 element, and the tail pointer points to the storage address of the last element 1; if the second period code stream B is 110110 and overflows, then B is first flipped to A after reaching the buffer area, that is, the elements between the two pointers are flipped, A is changed to 011100, and then B is stored after A, at this time, the stored code stream is updated to 011100110110. In the next step, the flip pointer points to the storage address of the lowest bit 0 element of the updated stored code stream, and the tail pointer also points to the storage address of the last element 0 element of the code stream. At this time, a round of flipping and code stream storage operation is completed.
[0057] In a specific embodiment, the description information further includes the code stream length of the current input code stream; accordingly, storing the current input code stream to the buffer area includes: judging whether the remaining space of the buffer area is not less than the code stream length; if the remaining space is not less than the code stream length, obtaining the storage address pointed to by the tail pointer, taking the next address of the storage address as the initial storage address of the current input code stream, and storing the current input code stream to the buffer area from the initial storage address.
[0058] If the remaining space is less than the code stream length, the output of the element before the lowest bit 0 element in the target code stream is waited, and according to the element output result, the elements not output are sequentially moved and stored to the storage space occupied by the output elements in the buffer area, until the remaining space is not less than the code stream length, the current input code stream is stored to the buffer area. It can be seen that the buffer area provided in the embodiment supports left shift output, so the storage space of the output elements is occupied by the elements not output. Since the element storage address is changed, the addresses pointed to by the flip pointer and the tail pointer also need to be updated accordingly, but the elements pointed to by the pointers remain unchanged.
[0059] If the current input code stream corresponds to the non-overflow identification information, the current stored code stream is not affected by the current input code stream, and therefore in a specific embodiment, it further includes: according to the non-overflow identification information in the description information, keeping all element values in the to-be-flipped code stream unchanged to obtain the target code stream.
[0060] In one embodiment, if it is determined by the description information that the current input code stream corresponds to non-overflow identification information, the flipping operation is not needed to be performed, and the current input code stream is directly stored, and the two pointers are updated accordingly. For example, if the code stream of the first period input buffer (i.e. the current stored code stream) is 101, after the code stream 101 is stored in the buffer, the flipping pointer points to the address of the 0 element in 101, and the tail pointer points to the address of the last element 1 in 101. If the second period input code stream is 111, and 111 does not overflow, the first period code stream 101 does not need to be flipped, that is, the second period code stream 111 does not change the first period code stream 101. At this time, the second period code stream 111 is directly stored, so that the stored code stream is updated to 101111. For the stored code stream 101111, the flipping pointer points to the address of the lowest 0 element, and the tail pointer points to the address of the last element 1 in 101111.
[0061] For example, if the code stream of the first period input buffer (i.e. the current stored code stream) is 101, after the code stream 101 is stored in the buffer, the flipping pointer points to the address of the 0 element in 101, and the tail pointer points to the address of the last element 1 in 101. If the second period input code stream is 100, and 100 does not overflow, the first period code stream 101 does not need to be flipped, that is, the second period code stream 100 does not change the first period code stream 101. At this time, the second period code stream 100 is directly stored, so that the stored code stream is updated to 101100. For the stored code stream 101100, the flipping pointer points to the address of the lowest 0 element, and the tail pointer points to the address of the last element 0 in 101100. For the stored code stream 101100, the outputtable element is 10110. If 10110 is output, the storage position of the last element 0 in 101100 is shifted to the left, and the addresses pointed to by the two pointers are updated accordingly, but the elements pointed to by the pointers are not changed.
[0062] In one embodiment, the method further comprises receiving a code stream output signal, and determining the element stored in the previous address of the address pointed to by the flipping pointer as the output code stream according to the code stream output signal.
[0063] In one embodiment, the method further comprises, if a code stream termination signal is received, determining the data stored in the address pointed to by the tail pointer and the previous address thereof as the output code stream.
[0064] Specifically, because the code stream between the flip pointer and the tail pointer is the code stream to be flipped, the elements before the flip pointer are all certain elements and do not need to be flipped, that is, when the code stream output signal is received, the element before the flip pointer can be pointed to as the certain code stream output according to the code stream output signal. When the code stream termination signal is received, the data stored in the address pointed to by the tail pointer and the address before the tail pointer are output as the certain code stream, that is, the code stream stored in the buffer is completely output.
[0065] The embodiment is provided with a buffer in the encoder, and a flip pointer and a tail pointer are provided in the buffer. The flip pointer points to the lowest bit 0 element in the current stored code stream in the buffer, and the tail pointer points to the last element in the current stored code stream in the buffer. Because the code stream after the CABAC encoding may overflow, the code stream between the flip pointer and the tail pointer may be flipped due to the overflow of the code stream after the period, and therefore the code stream between the flip pointer and the tail pointer is the code stream to be flipped. Accordingly, after receiving the current input code stream (for example, the code stream after the next period of the current stored code stream) and the description information of the current input code stream, the embodiment performs a flipping operation on the code stream to be flipped according to the overflow identification information in the description information to obtain a target code stream, stores the current input code stream in the buffer to obtain an updated stored code stream, and then makes the flip pointer point to the lowest bit 0 element in the updated stored code stream and makes the tail pointer point to the last element in the updated stored code stream.
[0066] It can be seen that the embodiment uses two pointers to indicate the storage address of the lowest bit 0 element and the storage address of the last element in the stored code stream stored in the buffer. When it is determined that the current input code stream after the period overflows, all the elements between the lowest bit 0 element and the last element at the end of the code stream in the stored code stream are taken as the code stream to be flipped, and the code stream to be flipped is flipped, thereby solving the overflow problem caused by the new input code stream and solving the bitsOutstanding problem of the CABAC encoding.
[0067] Please refer to Figure 3 , the CABAC encoding process can include:
[0068] Step 1, the VPU or other video processor loads the syntax information (integer) required by the current task from the upper module to the buffer (SRAM).
[0069] Step 2, arrange the syntax information in the buffer according to the order of the 266 protocol, and perform binaryization using CABAC encoding.
[0070] Step 3, select a suitable probability model to encrypt the binary information to obtain the bin value of the binary syntax information after updating, that is, the encrypted bit stream.
[0071] Step 4: The encrypted bit stream bits_in is input into the buffer provided by any register in the encoder. Whether the bits_in input in the next cycle overflows determines whether the bit stream between the waddr_confirm pointer (the flip pointer) and the waddr_all pointer (the tail pointer) in the buffer needs to be flipped. If it needs to be flipped, the bit stream between the waddr_confirm pointer and the waddr_all pointer is flipped and then the waddr_all pointer and the waddr_confirm pointer are updated. If it does not need to be flipped, the bits_in is directly stored and the waddr_all pointer and the waddr_confirm pointer are updated. The waddr_all pointer and the waddr_confirm pointer are used to solve the bitsOutstanding problem of CABAC encoding. When the 266 protocol is used, the maximum bit stream that needs to be flipped is 256 bits. Therefore, the storage space of the buffer is set to an integer multiple of the bit stream of a single cycle, such as 512 bits.
[0072] See Figure 4 In each cycle, the buffer has four input signals: the binary arithmetic encoded bit stream bits_in, the bit stream length bits_in_len of the bits_in, the carry flag Carry_flag of whether the bits_in overflows, and the position Zeros_pos of the last 0 element in the bits_in. Therefore, it can be considered that the bits_in input in each cycle includes: the bit stream itself, the bit stream length bits_in_len, the overflow carry flag Carry_flag, and the position of the last 0 element in the current bit stream.
[0073] The carry flag (Carry_flag) of the next cycle's bitstream determines whether a flip has occurred between waddr_all and waddr_confirm. If the Carry_flag of the next cycle's input bits_in is 1, the bits_in overflows, requiring a carry operation. Therefore, the values of all elements at the addresses pointed to by the waddr_confirm and waddr_all pointers in the buffer are inverted to achieve element flipping. If the Carry_flag of the next cycle's input bits_in is 0, the bits_in does not overflow, and no carry operation is needed. Therefore, the currently input bits_in is stored, and the waddr_confirm and waddr_all pointers are updated as needed. Simultaneously, the bitstream that will not flip is identified in the buffer and output. If the buffer receives the final terminating encoding signal, all bitstreams before the waddr_all pointer are output; otherwise, the aforementioned steps are repeated. All output bitstreams can be decoded and displayed, or sent to other devices.
[0074] See a specific example. Figure 5 If the last element of the first-cycle bitstream already stored in the buffer is 110110, and the second-cycle bitstream is an all-1s, no-overflow bitstream: 11111111111, then the arrival of the second-cycle bitstream 1111111111 in the buffer will not cause the first-cycle bitstream to flip. Simultaneously, after the second-cycle bitstream 1111111111 is stored in the buffer, the waddr_confirm pointer is not updated and still points to the address of the last element 0 of the last element 110110 in the first-cycle bitstream. Only the waddr_all pointer is updated to the address of the last element 1 in the second-cycle bitstream 11111111111. At this point, it can be considered that the first-cycle and second-cycle bitstreams have been merged into a stored bitstream. Upon reaching the third cycle (… Figure 5 If the third-cycle bitstream (11011111111) overflows during the current cycle, then the third-cycle bitstream will flip the last element 0 of the first-cycle bitstream and all elements of the second-cycle bitstream. After the flip, the waddr_confirm pointer is updated to the address of the 0 element in the third-cycle bitstream (11011111111), and the waddr_all pointer is updated to the address of the last element 1 in the third-cycle bitstream (11011111111). After the flip, all elements before the 0 element in the third-cycle bitstream (11011111111) can be output as a definitive bitstream, and the storage location of any unoutput elements is shifted left. Of course, the waddr_all and waddr_confirm pointers also need to be updated accordingly.
[0075] According to Figure 5 As shown in FIG. 16, if the code stream reaching the cache area in the next period is a full 1 non-overflow code stream, the next period also does not need to perform the flipping operation, only the newly input code stream is stored, and after the storage, only the waddr_all pointer is updated without updating the waddr_confirm pointer, and then waiting for the input of the subsequent code stream.
[0076] It can be seen that the cache area BUF designed in the embodiment allows left shift output of data, and the two write pointers waddr_confirm and waddr_all set in the cache area BUF cooperate with each other to solve the bitsOutstanding problem of CABAC encoding. The bit stream before the waddr_confirm pointer is determined not to be flipped, and the waddr_all pointer points to the tail address of all the bit streams stored in the BUF. The embodiment only uses one BUF and the two write pointers waddr_confirm and waddr_all in the BUF to solve the bitsOutstanding problem of CABAC encoding, to solve the hardware overhead, and to reduce the complexity of the scheme.
[0077] Next, an encoding device provided by the embodiment of the application is introduced, and the encoding device described below can be referred to the encoding method described above.
[0078] Referring to Figure 6 As shown in FIG. 17, the embodiment of the application discloses an encoding device applied to an encoder, the encoder including a cache area, the cache area being provided with a flipping pointer and a tail pointer, the flipping pointer pointing to the lowest 0 element in the current stored code stream in the cache area, and the tail pointer pointing to the last element in the current stored code stream, wherein the code stream between the flipping pointer and the tail pointer is a to-be-flipped code stream, and the device includes:
[0079] The receiving module 601 is configured to receive a current input code stream and description information of the current input code stream.
[0080] The flipping module 602 is configured to perform a flipping operation on the to-be-flipped code stream according to the overflow identification information in the description information to obtain a target code stream.
[0081] The storage module 603 is configured to store the current input code stream to the cache area to obtain an updated stored code stream, wherein the flipping pointer points to the lowest 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
[0082] In a specific implementation, the flipping module is specifically configured to:
[0083] perform an inversion operation on all element values in the to-be-flipped code stream according to the overflow identification information to obtain the target code stream.
[0084] In a specific implementation, the method further comprises:
[0085] The non-inversion module is configured to keep all element values in the to-be-inverted code stream unchanged according to the non-overflow identification information in the description information, and obtain the target code stream.
[0086] In a specific implementation, the description information further comprises: a code stream length of the current input code stream.
[0087] Correspondingly, the storage module is specifically configured to:
[0088] determine whether the remaining space of the cache area is not less than the code stream length;
[0089] If the remaining space is not less than the code stream length, the storage address pointed to by the tail pointer is obtained, the next address of the storage address is taken as an initial storage address of the current input code stream, and the current input code stream is stored in the cache area starting from the initial storage address.
[0090] If the remaining space is less than the code stream length, the output of elements before the lowest bit 0 element in the target code stream is waited, and according to the element output result, the elements that are not output are sequentially moved and stored in the storage space occupied by the output elements in the cache area, until the remaining space is not less than the code stream length, the current input code stream is stored in the cache area.
[0091] In a specific implementation, the description information further comprises: position record information of the lowest bit 0 element in the current input code stream; correspondingly, if the position record information is not default invalid information, it is determined that the current input code stream is not a full 1 code stream; otherwise, it is determined that the current input code stream is a full 1 code stream.
[0092] In a specific implementation, the current input code stream and the stored code stream are binary encrypted bit streams obtained based on CABAC encoding, and the time period of the current input code stream is later than that of the stored code stream.
[0093] In a specific implementation, the method further comprises:
[0094] The output module is configured to, if the code stream termination signal is received, output the data stored in the address pointed to by the tail pointer and the address before the address as the determined code stream.
[0095] The more specific working processes of the modules and units in the embodiments can refer to the corresponding contents disclosed in the foregoing embodiments, and will not be described here in detail.
[0096] It can be seen that the embodiment provides an encoding device, which can solve the bitsOutstanding problem of CABAC encoding by using two pointers.
[0097] An electronic device provided by an embodiment of the present application is described below. The electronic device described below can be mutually referred to with the encoding method and device described above.
[0098] Referring to Figure 7 As shown in the drawings, an embodiment of the present application discloses an electronic device, comprising:
[0099] The memory 701 is configured to store a computer program.
[0100] The processor 702 is configured to execute the computer program to implement the method disclosed in any of the above embodiments.
[0101] An electronic device provided by an embodiment of the present application is described below. The electronic device described below can be mutually referred to with the encoding method and device described above.
[0102] A readable storage medium is configured to store a computer program, wherein the computer program is executed by a processor to implement the encoding method disclosed in the above embodiment. For specific steps of the method, refer to the corresponding content disclosed in the above embodiment, which will not be described here.
[0103] The "first", "second", "third", "fourth" and the like (if any) described in the present application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods or devices.
[0104] It should be noted that the description involving "first", "second" and the like in the present application is only for descriptive purpose, and should not be understood as indicating or implying its relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include at least one of the features. In addition, the technical solutions of various embodiments can be combined with each other, but it must be based on the realization of a person skilled in the art, when the combination of technical solutions appears contradictory or unachievable, it should be considered that the combination of technical solutions does not exist, nor within the protection scope required by the present application.
[0105] The various embodiments described in this specification are presented for the purpose of illustration and description. Each of the embodiments highlights a different aspect of the application, and the embodiments are presented separately for ease of understanding. However, it will be apparent to those of ordinary skill in the art that the embodiments can be combined in different ways, and that the embodiments can be used individually or in any combination.
[0106] The steps of a method or algorithm described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module can reside in random access memory (RAM), non-volatile memory (ROM), erasable programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), registers, hard disk, a removable disk, a CD-ROM, or any other form of readable storage medium known in the art. An exemplary storage medium is coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, hard disk can be used as a storage medium.
[0107] The principles and implementations of the present application have been described above with the specific examples. The above description of the embodiments is merely intended to help understand the method of the present application and its core idea; meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation and application scope can be changed; in summary, the content of the specification should not be understood as a limitation of the present application.
Claims
1. An encoding method characterized by comprising: The method is applied to an encoder, the encoder comprising a buffer area provided with a flip pointer and a tail pointer, the flip pointer pointing to a lowest bit 0 element in a current stored code stream in the buffer area, and the tail pointer pointing to a last element in the current stored code stream, wherein a code stream between the flip pointer and the tail pointer is a code stream to be flipped, and the method comprises the following steps: receiving a current input code stream and description information of the current input code stream; performing a flipping operation on the code stream to be flipped according to overflow identification information in the description information to obtain a target code stream; storing the current input code stream into the buffer area to obtain an updated stored code stream, wherein the flip pointer points to a lowest bit 0 element in the updated stored code stream, and the tail pointer points to a last element in the updated stored code stream.
2. The method of claim 1, wherein, The method further comprises the following steps: maintaining all element values in the code stream to be flipped unchanged according to non-overflow identification information in the description information to obtain the target code stream.
3. The method of claim 1, wherein, The description information further comprises a code stream length of the current input code stream. Accordingly, the step of storing the current input code stream into the buffer area comprises the following steps:
4. The method of claim 1, wherein, determining whether a remaining space of the buffer area is not less than the code stream length; if the remaining space is not less than the code stream length, obtaining a storage address pointed to by the tail pointer, taking a next address of the storage address as an initial storage address of the current input code stream, and storing the current input code stream into the buffer area from the initial storage address; if the remaining space is less than the code stream length, waiting for output of an element before a lowest bit 0 element in the target code stream, and moving, according to an element output result, an element not outputted in sequence to a storage space occupied by the outputted element in the buffer area until the remaining space is not less than the code stream length, and then storing the current input code stream into the buffer area. The description information further comprises position record information of the lowest bit 0 element in the current input code stream. Accordingly, if the position record information is not default invalid information, it is determined that the current input code stream is not a full 1 code stream; otherwise, it is determined that the current input code stream is a full 1 code stream.
5. The method of claim 1, wherein, The method further comprises the following steps: receiving a code stream output signal, and taking an element stored in a previous address of a pointing address of the flip pointer as a determined code stream output according to the code stream output signal.
6. The method of claim 1, wherein, The method further comprises the following steps: if a code stream termination signal is received, taking data stored in an address pointed to by the tail pointer and a previous address of the address as a determined code stream output.
7. The method according to any one of claims 1 to 6, characterized in that, 8. An encoding apparatus, comprising: The application is applied to an encoder, the encoder comprises a buffer area, the buffer area is provided with a flip pointer and a tail pointer, the flip pointer points to the lowest bit 0 element in a current stored code stream in the buffer area, the tail pointer points to the last element in the current stored code stream, wherein the code stream between the flip pointer and the tail pointer is a code stream to be flipped, and the device comprises: a receiving module, configured to receive a current input code stream and description information of the current input code stream; a flipping module, configured to perform a flipping operation on the code stream to be flipped according to overflow identification information in the description information, to obtain a target code stream; a storage module, configured to store the current input code stream to the buffer area to obtain an updated stored code stream, wherein the flip pointer points to the lowest bit 0 element in the updated stored code stream, and the tail pointer points to the last element in the updated stored code stream.
9. An electronic device, comprising: comprise: a memory, configured to store a computer program; a processor, configured to execute the computer program to implement the method in any one of claims 1 to 7.
10. A readable storage medium, characterized by, a computer program is stored, wherein the computer program is executed by a processor to implement the method in any one of claims 1 to 7.
Citation Information
Patent Citations
Slice encoding and decoding processors, circuits, devices, systems and processes
US20110280314A1
Encoding method and memory storage apparatus using the same
US20190340070A1