CN116112670A - Encoding method, apparatus, device and readable storage medium - Google Patents

Encoding method, apparatus, device and readable storage medium Download PDF

Info

Publication number
CN116112670A
CN116112670A CN202310102345.7A CN202310102345A CN116112670A CN 116112670 A CN116112670 A CN 116112670A CN 202310102345 A CN202310102345 A CN 202310102345A CN 116112670 A CN116112670 A CN 116112670A
Authority
CN
China
Prior art keywords
code stream
pointer
current input
stored
buffer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310102345.7A
Other languages
Chinese (zh)
Inventor
黄刚毅
禹治祥
邱军
陈州辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Goke Microelectronics Co Ltd
Original Assignee
Hunan Goke Microelectronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Goke Microelectronics Co Ltd filed Critical Hunan Goke Microelectronics Co Ltd
Priority to CN202310102345.7A priority Critical patent/CN116112670A/en
Publication of CN116112670A publication Critical patent/CN116112670A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/13Adaptive entropy coding, e.g. adaptive variable length coding [AVLC] or context adaptive binary arithmetic coding [CABAC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/184Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being bits, e.g. of the compressed video stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The application discloses an encoding method, an encoding device, encoding equipment and a readable storage medium in the technical field of computers. According to the method and the device, the buffer area is arranged in the encoder, the turnover pointer and the tail pointer are arranged in the buffer area, the two pointers are used for indicating the lowest-order 0 element storage address and the last-order element storage address in the stored code stream, when the later input code stream is determined to overflow, all elements between the lowest-order 0 element in the stored code stream and the last-order element at the tail of the code stream can be used as the code stream to be turned over and turned over, the overflow problem caused by the new input code stream is solved, and therefore the overflow problem of CABAC coding is solved. Accordingly, the encoding device, the encoding equipment and the readable storage medium also have the technical effects.

Description

Encoding method, apparatus, device and readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an encoding method, apparatus, device, and readable storage medium.
Background
Currently, the binary code stream of the last clock cycle obtained based on CABAC (Context-based Adaptive Binary Arithmatic Coding, context-adaptive binary arithmetic coding) is affected by the binary code stream of the next clock cycle. If there is an overflow in the binary stream for the next clock cycle, then the elements in the binary stream for one clock cycle need to be flipped. This situation is known as the bitoutputing problem of CABAC coding.
Therefore, how to solve the bitsouttanding problem of CABAC coding is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
In view of the foregoing, it is an object of the present application to provide an encoding method, apparatus, device and readable storage medium to solve the problem of bitsouttanding of CABAC encoding. The specific scheme is as follows:
in a first aspect, the present application provides an encoding method, applied to an encoder, where the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a least significant 0 element in a current stored code stream in the buffer, and the tail pointer points to a last significant element in the current stored code stream, where a code stream between the flip pointer and the tail pointer is a code stream to be flipped, and the method includes:
receiving a current input code stream and description information of the current input code stream;
according to the overflow identification information in the description information, the code stream to be overturned is overturned 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 overturning pointer points to the lowest-order 0 element in the updated stored code stream, and the tail pointer points to the last-order element in the updated stored code stream.
Optionally, the performing the 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 includes:
and performing inverting operation on all element values in the code stream to be inverted according to the overflow identification information to obtain the target code stream.
Optionally, the method further comprises:
and according to the non-overflow identification information in the description information, keeping all element values in the code stream to be overturned unchanged to obtain the target code stream.
Optionally, the description information further includes: the code stream length of the current input code stream;
correspondingly, the storing the current input code stream in the buffer area includes:
judging whether the residual space of the buffer area is not smaller than the code stream length;
if the residual space is not smaller than the code stream length, a storage address pointed by the tail pointer is obtained, the next address of the storage address is used as an initial storage address of the current input code stream, and the current input code stream is stored in the buffer area from the initial storage address;
and if the residual space is smaller than the length of the code stream, waiting for the output of the element before the element 0 at the lowest position in the target code stream, and sequentially moving and storing the elements which are not output to the storage space occupied by the output element in the buffer area according to the element output result until the residual space is not smaller than the length of the code stream, and storing the current input code stream to the buffer area.
Optionally, the description information further includes: the position record information of the lowest 0 element in the current input code stream;
correspondingly, if the position record information is not the default invalid information, determining that the current input code stream is not the all 1 code stream; otherwise, determining that the current input code stream is the all 1 code stream.
Optionally, the method further comprises:
and receiving a code stream output signal, and outputting the element stored in the previous address of the address pointed by the turning pointer as a determined code stream according to the code stream output signal.
Optionally, the method further comprises:
and if the code stream termination signal is received, outputting the address pointed by the tail pointer and the data stored in the previous address as a determined code stream.
In a second aspect, the present application provides an encoding apparatus applied to an encoder, where the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a least significant 0 element in a current stored code stream in the buffer, and the tail pointer points to a last significant element in the current stored code stream, where a code stream between the flip pointer and the tail pointer is a code stream to be flipped, and the apparatus includes:
the receiving module is used for receiving the current input code stream and the description information of the current input code stream;
the overturning module is used for overturning the code stream to be overturned according to the overflow identification information in the description information to obtain a target code stream;
and the storage module is used for storing the current input code stream into the buffer area to obtain an updated stored code stream, wherein the turning pointer points to the lowest-order 0 element in the updated stored code stream, and the tail pointer points to the last-order element in the updated stored code stream.
In a third aspect, the present application provides an electronic device, including:
a memory for storing a computer program;
a processor for executing the computer program to implement the encoding method disclosed above.
In a fourth aspect, the present application provides a readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the encoding method disclosed above.
As can be seen from the above solution, the present application provides an encoding method, applied to an encoder, where the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a lowest-order 0 element in a current stored code stream in the buffer, and the tail pointer points to a last-order element in the current stored code stream, where a code stream between the flip pointer and the tail pointer is a code stream to be flipped, and the method includes: receiving a current input code stream and description information of the current input code stream; according to the overflow identification information in the description information, the code stream to be overturned is overturned 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 overturning pointer points to the lowest-order 0 element in the updated stored code stream, and the tail pointer points to the last-order element in the updated stored code stream.
Therefore, the buffer area is arranged in the encoder, the turnover pointer and the tail pointer are arranged in the buffer area, the turnover pointer points to the lowest-order 0 element in the current stored code stream in the buffer area, the tail pointer points to the last-order element in the current stored code stream in the buffer area, and the code stream between the turnover pointer and the tail pointer is the code stream to be turned because the later period code stream of CABAC coding possibly overflows, so that the code stream between the turnover pointer and the tail pointer possibly turns over due to the overflow of the later period 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 method and the device perform turning operation on the code stream to be turned according to the overflow identification information in the description information to obtain the target code stream; and storing the current input code stream into a buffer area to obtain an updated stored code stream, and enabling a turning pointer to point to the lowest-order 0 element in the updated stored code stream and a tail pointer to point to the last-order element in the updated stored code stream. This can be achieved by: when the current input code stream overflows later, all elements between the least significant 0 element and the last significant element in the current stored code stream are turned over first, so as to solve the overflow problem caused by the new input code stream.
Accordingly, the encoding device, the encoding equipment and the readable storage medium also have the technical effects.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort to a person skilled in the art.
FIG. 1 is a flow chart of an encoding method disclosed in the present application;
fig. 2 is a schematic diagram of a code stream storage location disclosed in the present application;
FIG. 3 is a schematic diagram of a CABAC coding process disclosed in the present application;
FIG. 4 is a schematic diagram of a buffer structure and an input signal disclosed in the present application;
FIG. 5 is a schematic diagram of a pointer disclosed herein;
FIG. 6 is a schematic diagram of an encoding apparatus disclosed herein;
fig. 7 is a schematic diagram of an electronic device disclosed in the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
In order to solve the problem of bitsOutstanding of CABAC coding, the application provides a coding scheme which can effectively solve the problem of bitsOutstanding of CABAC coding.
Referring to fig. 1, an embodiment of the application discloses an encoding method, applied to an encoder, where the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a lowest-order 0 element in a current stored code stream in the buffer, the tail pointer points to a last-order element in the current stored code stream, and the code stream between the flip pointer and the tail pointer is the code stream to be flipped, and the method includes:
s101, receiving the current input code stream and description information of the current input code stream.
It should be noted that, the current input code stream and the current stored code stream in the buffer are binary encrypted bit streams obtained based on CABAC encoding. CABAC coding mainly includes: and loading the context grammar information to be encoded into a cache, sequencing the grammar information according to a set protocol (such as 266 protocol), converting the arranged grammar information into a binary sequence by using a CABAC coding mode, and then selecting a proper probability model according to the set protocol to encrypt the binary sequence to obtain a binary encrypted bit stream. The present embodiment periodically inputs these binarized encrypted bitstreams into a buffer in the encoder to solve the bitoutlisting problem of CABAC encoding by using two pointers set in the buffer. After the last code stream is input into the buffer, the buffer may be notified that the current code stream has ended by a code stream termination signal.
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 the all 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 lowest 0 element in the current input code stream is located.
In one embodiment, the description information of the current input code stream includes: overflow identification information corresponding to the current input code stream.
S102, according to the overflow identification information in the description information, the code stream to be overturned is overturned, and the target code stream is obtained.
S103, storing the current input code stream into a buffer area to obtain an updated stored code stream, wherein a turnover pointer points to the lowest-order 0 element in the updated stored code stream, and a tail pointer points to the last-order element in the updated stored code stream.
In this embodiment, the tail pointer points to the last element in the current stored stream, that is: the tail pointer points to the storage address of the last element in the current stored code stream in the buffer area; the current input code stream and the current stored code stream are: binarized encrypted bit stream based on CABAC encoding. Therefore, the current stored code stream is earlier than the current input code stream in the input buffer, and the current stored code stream may be the last cycle code stream of the current input code stream or the first several cycles code stream of the current input code stream. It can be seen that the time period of the current input code stream is later than the current stored code stream.
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; the processing object of the flip operation always refers to the element between the addresses pointed to by the two pointers, and includes the element pointed to by the two pointers.
In a specific embodiment, according to overflow identification information in the description information, performing a flipping operation on a code stream to be flipped to obtain a target code stream, including: and performing inverting operation on all element values in the code stream to be inverted according to the overflow identification information to obtain a target code stream. That is to say: when the current input code stream overflows, the elements stored in the addresses pointed by the turning pointer to the addresses pointed by the tail pointer can be turned over due to the overflow of the current input code stream, so that the values of the least significant 0 element and all elements behind the least significant 0 element in the current stored code stream can be inverted according to the turning pointer and the tail pointer, and the turning operation of the code stream to be turned over can be completed.
For example: if the code stream (i.e., the current stored code stream) of the first period input buffer is 101, after 101 is stored in the buffer, the flip pointer points to the address where the 0 element in 101 is located, and the tail pointer points to the address where the last element 1 in 101 is located. If the code stream input in the second period is 111 and the overflow identification information corresponds to 111, then 01 in the first period code stream 101 is the code stream to be flipped, and at this time, the code stream 01 to be flipped is flipped, as shown in fig. 2, 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 can be obtained. At this time, the flip pointer points to the lowest 0 element in the stream 110111, and the tail pointer points to the last 1 element in the stream 110111.
And the following steps: if the first periodic code stream A is 011011, the first periodic code stream must not overflow, so the code stream is directly stored after reaching the buffer area; after the storage, the flip pointer points to the address stored in the element 0 at the lowest position, and the tail pointer points to the address stored in the element 1 at the last position; if the second periodic code stream B is 110110 and overflows, the code stream to be flipped of a is flipped after B reaches the buffer, that is, the element between the two pointers is flipped, a becomes 01100, B is stored behind a, and at this time, the stored code stream is updated as follows: 011100110110. next, the flip pointer is made to point to the address stored in the lowest element 0 of the updated stored code stream, and the tail pointer is also made to point to the address stored in the last element 0 of the code stream. Thus, one turn of overturning and code stream storing operation is completed.
In one embodiment, the description information further includes: the code stream length of the current input code stream; correspondingly, storing the current input code stream into the buffer area comprises: judging whether the residual space of the buffer area is not less than the code stream length; if the remaining space is not smaller than the length of the code stream, a storage address pointed by the tail pointer is obtained, the next address of the storage address is used as an initial storage address of the current input code stream, and the current input code stream is stored in the buffer area from the initial storage address.
If the residual space is smaller than the length of the code stream, waiting for the output of the element before the element 0 at the lowest position in the target code stream, and sequentially moving and storing the elements which are not output to the storage space occupied by the output element in the buffer area according to the element output result until the residual space is not smaller than the length of the code stream, and storing the current input code stream to the buffer area. Therefore, the buffer area provided in this embodiment supports left shift output, so that the storage space of the output element is occupied by the element that is not output, and because the element storage address is changed, the addresses pointed by the flip pointer and the tail pointer also need to be updated correspondingly, but the element pointed by the pointer is unchanged.
If the non-overflow identification information corresponding to the current input code stream, the current stored code stream is not affected by the current input code stream, so in a specific embodiment, the method further includes: and according to the non-overflow identification information in the description information, keeping all element values in the code stream to be overturned unchanged to obtain the target code stream.
In a specific embodiment, if it is determined by the description information that the current input code stream corresponds to the non-overflow identification information, the flipping operation is not required to be performed, but the current input code stream is directly stored, and the two pointers are updated accordingly. For example: if the code stream (i.e., the current stored code stream) of the first period input buffer is 101, after 101 is stored in the buffer, the flip pointer points to the address where the 0 element in 101 is located, and the tail pointer points to the address where the last element 1 in 101 is located. If the second period input stream is 111 and 111 does not overflow, then the first period stream 101 does not need to be flipped, i.e.: the second periodic code stream 111 does not change the first periodic code stream 101. At this time, the second periodic code stream 111 is directly stored, so that the stored code stream is updated as follows: 101111; then for the stored stream 101111, the flip pointer points to the address where the lowest bit 0 element is located and the tail pointer points to the address where the last bit element 1 in 101111 is located.
And the following steps: if the code stream (i.e., the current stored code stream) of the first period input buffer is 101, after 101 is stored in the buffer, the flip pointer points to the address where the 0 element in 101 is located, and the tail pointer points to the address where the last element 1 in 101 is located. If the second period input code stream is 100 and 100 does not overflow, then the first period code stream 101 does not need to be flipped, that is: the second periodic code stream 100 does not change the first periodic code stream 101. At this time, the second periodic code stream 100 is directly stored, so that the stored code stream is updated as: 101100; for the stored stream 101100, the flip pointer points to the address where the lowest bit 0 element is located, and the tail pointer points to the address where the last bit element 0 in 101100 is located. For the stored code stream 101100, the elements that can be output are: 10110, if 10110 outputs, then the storage location of last element 0 in 101100 is shifted left and the addresses pointed to by the two pointers are updated accordingly, but the element pointed to by the pointers is unchanged.
In one embodiment, the method further comprises: and receiving a code stream output signal, and outputting the element stored in the previous address of the address pointed by the turning pointer as a determined code stream according to the code stream output signal.
In one embodiment, the method further comprises: if the code stream termination signal is received, the address pointed by the tail pointer and the data stored in the previous address are output as the determined code stream.
Specifically, since 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 determined elements, and flipping is not required, i.e., when the code stream output signal is received, the elements before the flip pointer points to the elements can be output as the determined code stream according to the code stream output signal. When the code stream termination signal is received, the address pointed by the tail pointer and the data stored in the previous address are output as a determined code stream, namely all stored code streams are output.
In this embodiment, a buffer area is provided in the encoder, and a flip pointer and a tail pointer are provided in the buffer area, where 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 in the buffer area, and since the post-period code stream of CABAC encoding may overflow, the code stream between the flip pointer and the tail pointer may be flipped due to overflow of the post-period code stream, so the code stream between the flip pointer and the tail pointer is the code stream to be flipped. Accordingly, in this embodiment, after receiving the current input code stream (for example, the next period code stream of the current stored code stream) and the description information of the current input code stream, according to the overflow identification information in the description information, the code stream to be flipped is flipped to obtain the target code stream; and storing the current input code stream into a buffer area to obtain an updated stored code stream, and enabling a turning pointer to point to the lowest-order 0 element in the updated stored code stream and a tail pointer to point to the last-order element in the updated stored code stream.
It can be seen that, in this embodiment, the two pointers are used to indicate the storage address of the least significant 0 element and the storage address of the last significant element in the stored code stream stored in the buffer area, when it is determined that the current input code stream overflows later, all the elements between the least significant 0 element in the stored code stream and the last significant element at the end of the code stream can be used as the code stream to be flipped, and the code stream to be flipped is used, so that the overflow problem caused by the new input code stream is solved, and the bitsouttanding problem of CABAC coding is solved.
Referring to fig. 3, the cabac encoding process may include:
in step 1, the video processor such as the VPU firstly loads grammar information (integer) required by the current task from the upper module into a cache (SRAM).
And 2, arranging the grammar information in the cache according to 266 protocol, and binarizing the grammar information by using CABAC coding.
And 3, selecting a proper probability model to encrypt the binarized information to obtain the bin value of the binarized grammar information after updating, namely an encrypted bit stream.
Step 4, inputting the bit_in of the encrypted bit stream into a buffer area provided by any register in the encoder, determining whether the bit stream between the waddr_confirm pointer (flip pointer) and the waddr_all pointer (tail pointer) in the buffer area needs to be flipped or not according to whether the bit_in input in the next period overflows, if so, updating the waddr_all pointer and the waddr_confirm pointer after flipping the bit stream between the waddr_confirm pointer and the waddr_all pointer; if the overturn is not needed, the bits_in is directly stored, and the waddr_all pointer and the waddr_confirm pointer are updated to solve the bitsOutstandingproblem of CABAC coding through the waddr_all pointer and the waddr_confirm pointer. When 266 protocol is adopted, the maximum 256-bit code stream needs to be flipped, so the storage space of the buffer is set to be an integer multiple of the single-period code stream, for example, 512 bits.
Referring to fig. 4, in each period, the buffer has four input signals: the bit stream bit_in after binary arithmetic coding, the bit stream length bit_in_len of the bit_in, a Carry flag of whether the bit_in overflows or not, and the position zeros_pos of the last 0 element in the bit_in. Bits_in entered per cycle can thus be considered to include: 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 of the current bit stream.
The Carry flag of the next period code stream can be used for judging whether the bit stream between the waddr_all and the waddr_confirm is overturned or not. If the carry_flag of the bits_in input in the next period is 1, the bits_in overflows and needs Carry operation, so that the values of all elements in addresses pointed by the addr_confirm pointer and the addr_all pointer in the buffer area are inverted to realize element overturning. If the carry_flag of the bit_in input in the next period is 0, the bit_in does not overflow and does not need Carry operation, so that the currently input bit_in is stored, the waddr_confirm pointer and the waddr_all pointer are updated according to the situation, and meanwhile, bit streams which cannot be overturned are determined in the buffer area and are output. If the buffer area receives the last termination coding signal, all bit streams before the waddr_all pointer are output; otherwise, repeating the steps. All the output bit streams can be decoded and displayed and can be sent to other devices.
Referring to fig. 5 for a specific example, if the last element of the first periodic code stream stored in the buffer is: 110110, and the second periodic code stream is an all 1 no overflow code stream: 11111111111, the second periodic code stream 11111111111 does not flip the first periodic code stream after reaching the buffer; meanwhile, after the second periodic code stream 11111111111 is stored in the buffer area, the waddr_confirm pointer is not updated and still points to the address of the last element 0 of the last element 110110 of the first periodic code stream, and only the waddr_all pointer is updated to the address of the last element 1 of the second periodic code stream 11111111111; this can be considered as: the first periodic code stream and the second periodic code stream are combined into a stored code stream. When the third period (the current period in fig. 5) is reached, if the third period code stream 11011111111 overflows, the third period code stream will flip all elements of the last element 0 of the first period code stream and the second period code stream, and after the flip, the addr_confirm pointer is updated to the address where the 0 element in the third period code stream 11011111111 is located, and the addr_all pointer is updated to the address where the last element 1 of the third period code stream 11011111111 is located. After the inversion, all elements before the 0 element in the third periodic code stream 11011111111 can be output as a certain code stream, and then the storage positions of the elements which are not output are shifted left, and of course, the waddr_all pointer and the waddr_confirm pointer also need to be updated accordingly.
According to fig. 5, if the code stream that arrives at the buffer area in the next cycle of the current cycle is all 1 no-overflow code stream, the next cycle does not need to perform a flipping operation either, only the newly input code stream needs to be stored, only the waddr_all pointer is updated after the storing, and the waddr_confirm pointer does not need to be updated, and then the input of the subsequent code stream is waited.
As can be seen, the buffer BUF designed in this embodiment allows data to be shifted left for output, and two write pointers are set in the buffer BUF: the waddr_confirm and the waddr_all are mutually matched, so that the bitsouttanding problem of CABAC coding can be solved. Wherein all bit streams preceding the waddr_confirm pointer are determined not to be flipped, the waddr_all pointer points to the tail address of all bit streams already stored in the BUF. The embodiment can solve the bitoutputing problem of CABAC coding by only using one BUF and two write pointers of the BUF, namely the waddr_confirm and the waddr_all, can solve the hardware cost and reduces the complexity of the scheme.
An encoding device provided in an embodiment of the present application is described below, and an encoding device described below and an encoding method described above may be referred to with each other.
Referring to fig. 6, an embodiment of the present application discloses an encoding device, applied to an encoder, where the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a lowest 0 element in a current stored code stream in the buffer, the tail pointer points to a last element in the current stored code stream, and the code stream between the flip pointer and the tail pointer is the code stream to be flipped, and the device includes:
a receiving module 601, configured to receive a current input code stream and description information of the current input code stream;
the overturning module 602 is configured to overturn the code stream to be overturned according to the overflow identification information in the description information, so as to obtain a target code stream;
the storage module 603 is configured to store a current input code stream in a buffer area to obtain an updated stored code stream, where the flip pointer points to a lowest-order 0 element in the updated stored code stream, and the tail pointer points to a last-order element in the updated stored code stream.
In one embodiment, the flipping module is specifically configured to:
and performing inverting operation on all element values in the code stream to be inverted according to the overflow identification information to obtain a target code stream.
In one specific embodiment, the method further comprises:
and the non-overturning module is used for keeping all element values in the code stream to be overturned unchanged according to the non-overflow identification information in the description information to obtain the target code stream.
In one embodiment, the description information further includes: the code stream length of the current input code stream;
correspondingly, the storage module is specifically used for:
judging whether the residual space of the buffer area is not less than the code stream length;
if the residual space is not smaller than the length of the code stream, a storage address pointed by a tail pointer is obtained, the next address of the storage address is used as an initial storage address of the current input code stream, and the current input code stream is stored in a buffer area from the initial storage address;
if the residual space is smaller than the length of the code stream, waiting for the output of the element before the element 0 at the lowest position in the target code stream, and sequentially moving and storing the elements which are not output to the storage space occupied by the output element in the buffer area according to the element output result until the residual space is not smaller than the length of the code stream, and storing the current input code stream to the buffer area.
In one embodiment, the description information further includes: recording information of the position of the lowest 0 element in the current input code stream; correspondingly, if the position record information is not the default invalid information, determining that the current input code stream is not the all 1 code stream; otherwise, determining the current input code stream as the all 1 code stream.
In one embodiment, the current input code stream and the stored code stream are binary encrypted bit streams based on CABAC encoding, and the current input code stream has a time period later than the stored code stream.
In one specific embodiment, the method further comprises:
and the output module is used for outputting the address pointed by the tail pointer and the data stored in the previous address as a determined code stream if the code stream termination signal is received.
The more specific working process of each module and unit in this embodiment may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
It can be seen that the present embodiment provides an encoding apparatus capable of solving the bitoutputing problem of CABAC encoding using two pointers.
An electronic device provided in an embodiment of the present application is described below, and an electronic device described below and an encoding method and apparatus described above may be referred to with each other.
Referring to fig. 7, an embodiment of the present application discloses an electronic device, including:
a memory 701 for storing a computer program;
a processor 702 for executing the computer program to implement the method disclosed in any of the embodiments above.
A readable storage medium according to an embodiment of the present application is described below, and the readable storage medium described below and an encoding method, apparatus and device described above may be referred to with reference to each other.
A readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the encoding method disclosed in the foregoing embodiments. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
Reference to "first," "second," "third," "fourth," etc. (if present) herein is used to distinguish similar objects from each other and does not necessarily describe a particular order or sequence. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, or apparatus.
It should be noted that the description herein of "first," "second," etc. is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implying an indication of the number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be regarded as not exist and not within the protection scope of the present application.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of readable storage medium known in the art.
The principles and embodiments of the present application are described herein with specific examples, the above examples being provided only to assist in understanding the methods of the present application and their core ideas; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. An encoding method, characterized in that it is applied to an encoder, the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a least significant 0 element in a current stored code stream in the buffer, the tail pointer points to a last significant 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, the method includes:
receiving a current input code stream and description information of the current input code stream;
according to the overflow identification information in the description information, the code stream to be overturned is overturned 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 overturning pointer points to the lowest-order 0 element in the updated stored code stream, and the tail pointer points to the last-order element in the updated stored code stream.
2. The method of claim 1, wherein the performing the flipping operation on the code stream to be flipped according to the overflow identification information in the description information to obtain the target code stream includes:
and performing inverting operation on all element values in the code stream to be inverted according to the overflow identification information to obtain the target code stream.
3. The method according to claim 1, wherein the method further comprises:
and according to the non-overflow identification information in the description information, keeping all element values in the code stream to be overturned unchanged to obtain the target code stream.
4. The method of claim 1, wherein the description information further comprises: the code stream length of the current input code stream;
correspondingly, the storing the current input code stream in the buffer area includes:
judging whether the residual space of the buffer area is not smaller than the code stream length;
if the residual space is not smaller than the code stream length, a storage address pointed by the tail pointer is obtained, the next address of the storage address is used as an initial storage address of the current input code stream, and the current input code stream is stored in the buffer area from the initial storage address;
and if the residual space is smaller than the length of the code stream, waiting for the output of the element before the element 0 at the lowest position in the target code stream, and sequentially moving and storing the elements which are not output to the storage space occupied by the output element in the buffer area according to the element output result until the residual space is not smaller than the length of the code stream, and storing the current input code stream to the buffer area.
5. The method of claim 1, wherein the description information further comprises: the position record information of the lowest 0 element in the current input code stream;
correspondingly, if the position record information is not the default invalid information, determining that the current input code stream is not the all 1 code stream; otherwise, determining that the current input code stream is the all 1 code stream.
6. The method according to claim 1, wherein the method further comprises:
and receiving a code stream output signal, and outputting the element stored in the previous address of the address pointed by the turning pointer as a determined code stream according to the code stream output signal.
7. The method according to any one of claims 1 to 6, further comprising:
and if the code stream termination signal is received, outputting the address pointed by the tail pointer and the data stored in the previous address as a determined code stream.
8. An encoding device, characterized in that it is applied to an encoder, the encoder includes a buffer, the buffer is provided with a flip pointer and a tail pointer, the flip pointer points to a least significant 0 element in a current stored code stream in the buffer, the tail pointer points to a last significant element in the current stored code stream, wherein, the code stream between the flip pointer and the tail pointer is the code stream to be flipped, the device includes:
the receiving module is used for receiving the current input code stream and the description information of the current input code stream;
the overturning module is used for overturning the code stream to be overturned according to the overflow identification information in the description information to obtain a target code stream;
and the storage module is used for storing the current input code stream into the buffer area to obtain an updated stored code stream, wherein the turning pointer points to the lowest-order 0 element in the updated stored code stream, and the tail pointer points to the last-order element in the updated stored code stream.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the method of any one of claims 1 to 7.
10. A readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the method of any one of claims 1 to 7.
CN202310102345.7A 2023-02-10 2023-02-10 Encoding method, apparatus, device and readable storage medium Pending CN116112670A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310102345.7A CN116112670A (en) 2023-02-10 2023-02-10 Encoding method, apparatus, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310102345.7A CN116112670A (en) 2023-02-10 2023-02-10 Encoding method, apparatus, device and readable storage medium

Publications (1)

Publication Number Publication Date
CN116112670A true CN116112670A (en) 2023-05-12

Family

ID=86267012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310102345.7A Pending CN116112670A (en) 2023-02-10 2023-02-10 Encoding method, apparatus, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN116112670A (en)

Similar Documents

Publication Publication Date Title
EP0653849A2 (en) Efficient utilization of present state/next state registers
TWI408600B (en) Conpute unit with an internal bit fifo circuit
US5619514A (en) In-place present state/next state registers
JPH05265922A (en) Direct memory access controller
JPS60140981A (en) Method and device for decoding digital coded word of coded word system
KR100282516B1 (en) Convolutional code generator and digital signal processor
US4570221A (en) Apparatus for sorting data words on the basis of the values of associated parameters
JP2005209108A (en) Microcomputer with external memory
CN116112670A (en) Encoding method, apparatus, device and readable storage medium
TW440867B (en) FIFO memory device and method for controlling same
US6205255B1 (en) Method and apparatus for run-length encoding of multi-colored images
JP2002009625A (en) Entropy codec for high-speed data compression/ decompression
JP2007174312A (en) Encoding circuit and digital signal processing circuit
EP3531560B1 (en) A binary-to-gray conversion circuit, related fifo memory, integrated circuit and method
CN111970007B (en) Decoding method, decoder, device and medium
KR20140114516A (en) A memory controller and a operating method of thereof
JP2006332982A (en) Decoder circuit and decoding method
EP1174790A1 (en) Method and apparatus for determining the number of empty memory locations in a FIFO memory device
CN108809320B (en) LZ 77-based data compression method, equipment and terminal
JPH0722969A (en) Arithmetic unit
JP3225763B2 (en) Encoding device and decoding device
CN102263562B (en) Method for reading and removing code stream data and apparatus thereof
JP2529465B2 (en) Variable length code decoding device
JP2005148904A (en) Ring buffer controller and ring buffer control method
KR100247062B1 (en) Fifo method and circuit having ring structure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination