The present application claims priority to Chinese patent application No. 202311146051.0, titled “Residual Data Writing Method and Apparatus, Computer Device, and Storage Medium”, and filed on Sep. 6, 2023, the content of which is hereby incorporated by reference in its entirety.
The present disclosure relates to the field of video encoding and decoding technology, particularly to a residual data writing method and apparatus, a computer device, a storage medium, and a computer program product.
With continuous updating of the encoding technology in the video encoding and decoding standards, the data volume for video encoding is constantly increasing. In order to improve a data compression rate, in the mainstream video encoding standards, inter-frame encoding is generally utilized to improve the video compression rate. In the inter-frame encoding, it is required to perform the difference between data of a current frame and data of a reference frame to obtain residual data, and perform the motion estimation with the residual data. With continuous updating of the encoding technology, the residual data volume increases constantly, and the access efficiency of the residual data greatly affects the encoding efficiency. Therefore, how to improve the access efficiency of the residual data is a problem that needs to be solved in the design of each encoder.
In conventional technology, motion estimation is divided into three phases: a coarse phase, a fine phase, and a fraction phase. The residual data is block data, and 16 pieces of residual data in every two pieces of 128-bit residual data in the coarse phase correspond to nine motion vectors. In the fine phase and the fraction phase, every two pieces of 128-bit data include data corresponding to 16 motion vectors. In an existing method, data corresponding to motion vectors is sequentially buffered in a row scanning sequence. For example, in the coarse phase, data corresponding to nine motion vectors is buffered according to a vector sequence, so that two pieces of 128-bit data need to be partitioned and spliced, and the data is stored in the SRAM nine times. In this manner, nine cycles are required to store two pieces of 128-bit residual data in the SRAM. For a 32×32 block, 512 pieces of residual data are required for each search, and 4608 cycles are required for buffering the data. The fine and fraction phases take longer to buffer the data, which leads to time redundancy for buffering the residual data, causing the encoder to be in an idle state for a long time, and seriously affecting the encoding efficiency of the encoder.
Currently, the writing time for the residual data is long, and accordingly, the access efficiency of the residual data is lower.
In view of this, as for the technical problem described above, it is necessary to provide a residual data writing method and apparatus, a computer device, a computer-readable storage medium, and a computer program product capable of improving the access efficiency of the residual data.
In the first aspect of the present disclosure, a residual data writing method is provided, including: determining a residual data reading mode comprising a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time; determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, wherein each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; acquiring a buffer index and a buffer address corresponding to to-be-written residual data; and writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In an embodiment, determining the residual data reading mode may include: configuring a residual data reading circuit comprising two data interfaces which are configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process; and reading the residual data from the buffer at least once through the two data interfaces of the residual data reading circuit.
In an embodiment, determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode may include: determining residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process according to the residual data reading mode, to configure two buffer groups; and configuring the same number of buffers in each buffer group.
In an embodiment, acquiring the buffer index and the buffer address corresponding to the to-be-written residual data may include: partitioning initial residual data acquired in a motion estimation target phase to obtain 16-bit to-be-written residual data; acquiring a vector coordinate corresponding to the to-be-written residual data according to a positional relationship between the to-be-written residual data and the initial residual data; acquiring a search center point corresponding to the initial residual data, obtaining a vector offset coordinate of the to-be-written residual data according to an offset between the vector coordinate and the search center point; and acquiring the buffer index and the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate.
In an embodiment, acquiring the buffer index corresponding to the to-be-written residual data according to the vector offset coordinate may include: concatenating buffer lines of all buffers with the same buffer depth according to a buffer index of each buffer to obtain a concatenated buffer line; acquiring a concatenation width of the concatenated buffer line according to a width of a buffer line of each buffer; determining a first position mapping relationship between the to-be-written residual data and the concatenated buffer line according to the vector offset coordinate and the concatenation width; and determining a buffer group and a buffer corresponding to the to-be-written residual data according to the first position mapping relationship, to determine the buffer index corresponding to the to-be-written residual data.
In an embodiment, the to-be-written residual data may include first residual data and second residual data which correspond to two adjacent motion vectors, and the determining the buffer group and the buffer corresponding to the to-be-written residual data according to the first position mapping relationship to determine the buffer index corresponding to the to-be-written residual data may include: determining a plurality of target buffers having a corresponding relationship according to an arrangement sequence of buffers in each buffer group, wherein each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; acquiring a difference parameter according to a buffer index of each target buffer; determining a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data respectively according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, correcting the second buffer index according to the difference parameter to obtain a third buffer index; and determining the first buffer index as a buffer index corresponding to the first residual data, and determining the third buffer index as a buffer index corresponding to the second residual data.
In an embodiment, acquiring the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate may include: determining a second position mapping relationship between the to-be-written residual data and a buffer depth according to the vector offset coordinate and the search center point; and determining a buffer depth corresponding to the to-be-written residual data according to the second position mapping relationship, to determine the buffer address corresponding to the to-be-written residual data.
In an embodiment, writing the to-be-written residual data into the corresponding buffer according to the buffer index and the buffer address may include: generating a mask corresponding to the buffer index and the buffer address; and writing the to-be-written residual data into the corresponding buffer according to the buffer index, the buffer address, and the mask.
In the second aspect of the present disclosure, a residual data writing apparatus is further provided, including: a determination module, configured to determine a residual data reading mode comprising a reading sequence of each piece of residual data, and the quantity of parameter data read simultaneously at each time; a configuration module, configured to determine the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, wherein each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; an acquisition module, configured to acquire a buffer index and a buffer address corresponding to to-be-written residual data; and a writing module, configured to write the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In the third aspect of the present disclosure, a computer device is further provided, including a processor and a memory storing a computer program, the processor, when executing the computer program, implements the steps of: determining a residual data reading mode comprising a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time; determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, wherein each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; acquiring a buffer index and a buffer address corresponding to to-be-written residual data; and writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In the fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, the computer program, when executed by a processor, causes the processor to implement the steps of: determining a residual data reading mode comprising a reading sequence of each piece of residual data, and the quantity of parameter data read simultaneously at each time; determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, wherein each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; acquiring a buffer index and a buffer address corresponding to to-be-written residual data; and writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In the fifth aspect of the present disclosure, a computer program product is provided, including a computer program, the computer program, when executed by a processor, causes the processor to implement the steps of: determining a residual data reading mode comprising a reading sequence of each piece of residual data, and the quantity of parameter data read simultaneously at each time; determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, wherein each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; acquiring a buffer index and a buffer address corresponding to to-be-written residual data; and writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In the above-mentioned residual data writing method and apparatus, computer device, storage medium, and the computer program product, a residual data reading mode is determined, which includes a reading sequence of each piece of residual data, and the quantity of parameter data read simultaneously at each time; the number of buffer groups and the number of buffers in each buffer group are determined according to the residual data reading mode, each buffer is provided with a unique buffer index, and each buffer comprises a plurality of buffer addresses; a buffer index and a buffer address corresponding to to-be-written residual data are acquired; and the to-be-written residual data is written into a corresponding buffer according to the buffer index and the buffer address. The residual data of different coordinates is written into the buffers at a time, in order to avoid writing residual data of only one coordinate at a time, thereby significantly reducing the clock period of data writing, greatly reducing the write time of the residual data, and improving the access efficiency of the residual data.
In order to describe the technical solution in the embodiments of the present disclosure or the related technologies more clearly, the accompanying drawings required for describing the embodiments or the related technologies will be briefly introduced below. Obviously, the accompanying drawings in the following description show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still obtain other drawings from these accompanying drawings without creative efforts.
In order to make the purpose, the technical solution and advantages of the present disclosure clearer, the present disclosure will be described in further detail with reference to the accompanying drawings and embodiments. It should be appreciated that the specific embodiments described herein are merely intended to explain the present disclosure, rather than limiting the present disclosure.
In an embodiment, as shown in
Optionally, a residual data read circuit is configured according to the determined residual data reading mode. For example, in the residual data reading manner, residual data corresponding to two adjacent motion vectors is read at a time. The residual data read circuit may be provided with two data interfaces, and each data interface is connected to a group of buffers. During each residual data read, the two data interfaces respectively read two pieces of residual data from the two groups of buffers at the same time.
The buffer group is represented with Bank, and the buffer is represented with Sram.
Optionally, when it is determined, according to the determined residual data reading mode, that residual data corresponding to two adjacent motion vectors needs to be read simultaneously in each residual data read process, two buffer groups are provided, and each buffer group includes the same number of buffers. For example, as shown in
Specifically, the residual data in the Coarse search phase is a two-dimensional block data. As shown in
The residual data format in the fine search phase is shown in
The buffer index is represented by “Index”, and the buffer address is represented by “Addr”.
Optionally, initial residual data acquired in the motion estimation target phase is partitioned to obtain 16-bit to-be-written residual data. A vector coordinate corresponding to the to-be-written residual data is acquired according to a positional relationship between the to-be-written residual data and the initial residual data. A search center point corresponding to the initial residual data is acquired, and a vector offset coordinate of the to-be-written residual data is obtained according to an offset between the vector coordinate and the search center point. The buffer index and the buffer address corresponding to the to-be-written residual data are acquired according to the vector offset coordinate.
Specifically, as shown in
Optionally, a mask corresponding to the buffer index and the buffer address is generated, and the to-be-written residual data is written into the corresponding buffer according to the buffer index, the buffer address, and the mask.
Specifically, as shown in
In the foregoing residual data writing method, the residual data reading mode is determined. The residual data reading mode may include a reading sequence of residual data and the quantity of residual data read simultaneously at each time. The number of the buffer groups and the number of the buffers in each buffer group are determined according to the residual data reading mode. Each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses. The buffer index and the buffer address corresponding to the to-be-written residual data are acquired. The to-be-written residual data is written into the corresponding buffer according to the buffer index and the buffer address. The residual data of different coordinates is written into the buffer at once, in order to avoid writing the residual data of only one coordinate at a time, thereby significantly reducing clock periods for data writing, greatly reducing the write time of the residual data, and improving the access efficiency of the residual data.
In an embodiment, the step of acquiring the buffer index and the buffer address corresponding to the to-be-written residual data, and writing the to-be-written residual data into the corresponding buffer according to the buffer index and the buffer address may further include the following steps.
At first, The initial residual data acquired in the motion estimation target phase is partitioned to obtain 16-bit to-be-written residual data, the vector coordinate corresponding to the to-be-written residual data is acquired according to the positional relationship between the to-be-written residual data and the initial residual data, the search center point corresponding to the initial residual data is acquired, and the vector offset coordinate of the to-be-written residual data is obtained according to the offset between the vector coordinate and the search center point.
Buffer lines of all buffers with the same buffer depth are concatenated according to the buffer index of each buffer to obtain a concatenated buffer line, a concatenation width of the concatenated buffer line is acquired according to a width of a buffer line of each buffer, a first position mapping relationship between the to-be-written residual data and the concatenated buffer line is determined according to the vector offset coordinate and the concatenation width, and the to-be-written residual data includes first residual data and second residual data that correspond to two adjacent motion vectors respectively.
Further, a plurality of target buffers having a corresponding relationship are determined according to an arrangement sequence of buffers in each buffer group. Each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups. A difference parameter is acquired according to a buffer index of each target buffer. A buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data are respectively determined according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data. when the first buffer index is the same as the second buffer index, the second buffer index is corrected according to the difference parameter to obtain a third buffer index. The first buffer index serves as the buffer index corresponding to the first residual data, and the third buffer index serves as the buffer index corresponding to the second residual data.
Further, a second position mapping relationship between the to-be-written residual data and the buffer depth is determined according to the vector offset coordinate and the search center point. A buffer depth corresponding to the to-be-written residual data is determined according to the second position mapping relationship, to determine a buffer address corresponding to the to-be-written residual data.
Finally, a mask corresponding to the buffer index and the buffer address is generated. The to-be-written residual data is written into the corresponding buffer according to the buffer index, the buffer address, and the mask.
Specifically, in one aspect, the address mapping in the coarse search phase is taken as an example, and the foregoing specific implementation process may include:
The vector coordinate of the search center is set as (scmvy, scmvx). The vector coordinate of a dark block in
The value of the horizontal mapping index ranges from 0 to 31. Since the storage layout is a Z-order layout, the coordinate index of data is as follows:
index=(Y[1],X[1],Y[0],X[0]).
In addition, data with adjacent coordinates is read using the same address at once, and indexes of the adjacent coordinates are the same, so that the coordinate index is as follows:
index=(Y[1],[1],Y[0]).
Since a piece of coordinate data consists of four pieces of 16-bit data, the reference block with the number parameter R is utilized to distinguish the data, so that the code is as follows:
index=(Y[1],X[1],Y[0],R[1],R[0]).
Considering the size of the CU is 32×32, there are four 16×16 blocks, and the data of the same coordinate exists in the same line. Assuming that the 16×16 block number is cu16[1:0], the code is as follows:
In the foregoing formula, adjacent coordinates have the same index. To ensure that adjacent coordinates are correctly stored in the corresponding sram, the following operations are performed on the adjacent coordinates, to ensure that one coordinate is stored in the sram0-sram3 and the other is stored in the sram4-sram7.
If index[4]!=x[0], index=index−16, where 16 is equivalent to a difference parameter.
Assuming that an offset coordinate in the x-direction is set as xoffset, and an offset coordinate in the y-direction is set as yoffset, then Addr is set as follows:
The search range is 8×8. Because the adjacent coordinates have the same address, xoffset is [3:1], and the address opening degree for each line is 4.
Each piece of 16-bit data corresponds to the mask for 512 bits as follows:
mask=1<<index.
Data needs to be shifted before the data is written, i.e., the data is shifted to a corresponding 512-bit position:
Data_sft=data<<index×16.
The data and mask are combined as follows:
Line_mask=mask0|mask1| . . . |mask15;
Line_data=data_sft0|datasft1| . . . |datasft15.
The line_mask is partitioned from the line_data, and data corresponding to the 0-7 sram is obtained and written into the corresponding sram according to the corresponding addr.
In another aspect, the address mapping in the fine search phase is taken as an example, and the specific implementation process may include:
Referring to
When a Z-order memory layout is used, the index is similar to that in the coarse search phase. The data is arranged in the sequence shown in
The horizontal mapping index may be derived from
In order to ensure that adjacent coordinate data is correctly stored in 0-3 sram and 4-7 sram, if (Index[4]!=X[0]), it indicates that the data that should be stored in 0-3 sram is stored in the 4-7 sram during the calculation overflow. The following operation is performed to ensure the correct storage: index=index−16, where 16 is equivalent to the difference parameter.
The vertical mapping is a sram address corresponding to each piece of data, and is calculated as follows:
Data writing in the fine search phase is the same as that in the coarse search phase, and details are not described herein again.
In the embodiment, data of nine different coordinates is written into the sram at a time during the coarse search phase. Compared with the conventional manner, seven clock periods are reduced per 256-bit data. During the fine search phase, data of 16 different coordinates is written into the sram at a time, and accordingly, 14 clock periods are reduced per 256-bit data compared to the conventional manner. When the residual data is read, the residual data of two adjacent coordinates can be read at a time, and accordingly, the MEE search efficiency is improved.
In an embodiment, the number of buffer groups, the number of buffers in each buffer group, and related parameters of the horizontal mapping and vertical mapping may be adjusted according to different video encoding and decoding requirements. The related parameters include but are not limited to a search range, a search block, a current block, and a size of a residual block.
Specifically, as the video resolution continuously increases, standards of video encoding and decoding also evolve as well, including a larger search range, a larger size of a search block, and modifications of the horizontal mapping and vertical mapping parameters, effect caused by the expanded search range and the expanded search block may be eliminated.
When the search range is expanded, the depth of the sram is correspondingly expanded, and a parameterized modification is performed on addr as follows:
When the search block becomes larger, the index is modified. Correspondingly, the number of the srams increases, and the parameterized modification is performed on addr as follows:
The search block is defined as Block, the current block is defined as MB, and the residual block is defined as subMB.
The index is modified as follows:
In the embodiment, if a new encoding standard is used, there is no need to redesign the mapping logics, and only corresponding buffer specifications and mapping parameters need to be adjusted, which has higher expandability.
In an embodiment, a residual data writing method includes the following steps.
A residual data reading circuit is provided. The residual data reading circuit includes two data interfaces; the two data interfaces are configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process; and residual data is read from the buffer at least once through the two data interfaces of the residual data reading circuit; the residual data reading mode includes a reading sequence of each piece of residual data and the quantity of residual data read simultaneously at each time.
The residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process is determined according to the residual data reading mode, to configure two buffer groups; the same number of buffers is configured in each buffer group; each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses.
Initial residual data acquired in a target phase of the motion estimation is partitioned to obtain 16-bit to-be-written residual data; a vector coordinate corresponding to the to-be-written residual data is acquired according to the positional relationship between the to-be-written residual data and the initial residual data; a search center point corresponding to the initial residual data is acquired, and a vector offset coordinate of the to-be-written residual data is obtained according to an offset between the vector coordinate and the search center point.
Buffer lines of all buffers with the same buffer depth are concatenated according to the buffer index of each buffer to obtain a concatenated buffer line; a concatenation width of the concatenated buffer line is acquired according to a width of a buffer line of each buffer; a first position mapping relationship between the to-be-written residual data and the concatenated buffer line is determined according to the vector offset coordinate and the concatenation width; the to-be-written residual data includes first residual data and second residual data, and the first residual data and the second residual data correspond to two adjacent motion vectors respectively.
A plurality of target buffers having a corresponding relationship are determined according to an arrangement sequence of buffers in each buffer group; each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; a difference parameter is acquired according to a buffer index of each target buffer; a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data are respectively determined according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, the second buffer index is corrected according to the difference parameter to obtain a third buffer index; the first buffer index serves as the buffer index corresponding to the first residual data, and the third buffer index serves as the buffer index corresponding to the second residual data.
A second position mapping relationship between the to-be-written residual data and the buffer depth is determined according to the vector offset coordinate and the search center point; and a buffer depth corresponding to the to-be-written residual data is determined according to the second position mapping relationship, to determine a buffer address corresponding to the to-be-written residual data.
A mask corresponding to the buffer index and the buffer address is generated; the to-be-written residual data is written into the corresponding buffer according to the buffer index, the buffer address, and the mask.
It should be appreciated that, although the steps in the flow chart involved in the embodiments described above are shown sequentially as indicated by the arrows, they are not definitely performed sequentially in the order indicated by the arrows. Unless explicitly stated in this article, there is no strict order in which these steps are executed, and these steps can be executed in other order. Moreover, at least some of the steps in the flow chart referred to in the embodiments mentioned above may include multiple steps or stages, which are not definitely performed at the same time, but may be performed at different moments, and these steps or stages are not definitely performed in sequence, but can be performed in turns or alternately with other steps or at least partial steps or phases within other steps.
Based on the same invention concept, in an embodiment of the present disclosure, a residual data writing apparatus for implementing the foregoing residual data writing method is provided. An implementation provided by the apparatus is similar to the implementation described in the foregoing method. Therefore, for the specific limitations in one or more embodiments of the residual data writing apparatus provided below, reference can be made to the foregoing limitations on the residual data writing method, which will not be repeated herein.
In an exemplary embodiment, as shown in
The determination module 901 is configured to determine a residual data reading mode including a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time.
The configuration module 902 is configured to determine the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, in which each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses.
The acquisition module 903 is configured to acquire a buffer index and a buffer address corresponding to the to-be-written residual data.
The writing module 904 is configured to write the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In an embodiment, the determination module 901 is further configured to: configure a residual data reading circuit including two data interfaces, in which the two data interfaces are configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process, and read the residual data from the buffer at least once through the two data interfaces of the residual data reading circuit.
In an embodiment, the configuration module 902 is further configured to determine residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process according to the residual data reading mode to configure two buffer groups, and configure the same number of buffers in each buffer group.
In an embodiment, the acquisition module 903 is further configured to: partition initial residual data acquired in the motion estimation target phase to obtain 16-bit to-be-written residual data; acquire a vector coordinate corresponding to the to-be-written residual data according to a positional relationship between the to-be-written residual data and the initial residual data; acquire a search center point corresponding to the initial residual data; obtain a vector offset coordinate of the to-be-written residual data according to an offset between the vector coordinate and the search center point; and acquire the buffer index and the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate.
In an embodiment, the acquisition module 903 is further configured to: concatenate buffer lines of all buffers with the same buffer depth according to the buffer index of each buffer to obtain a concatenated buffer line; acquire a concatenation width of the concatenated buffer line according to a width of a buffer line of each buffer; determine a first position mapping relationship between the to-be-written residual data and the concatenated buffer line according to the vector offset coordinate and the concatenation width; and determine the buffer group and the buffer corresponding to the to-be-written residual data according to the first position mapping relationship, to determine the buffer index corresponding to the to-be-written residual data.
In an embodiment, the to-be-written residual data includes first residual data and second residual data which correspond to two adjacent motion vectors. The acquisition module 903 is further configured to: determine a plurality of target buffers having a corresponding relationship according to an arrangement sequence of buffers in each buffer group, in which each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; acquire a difference parameter according to a buffer index of each target buffer; determine a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data respectively according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, correct the second buffer index according to the difference parameter to obtain a third buffer index; determine the first buffer index as the buffer index corresponding to the first residual data, and determine the third buffer index as the buffer index corresponding to the second residual data.
In an embodiment, the acquisition module 903 is further configured to: determine a second position mapping relationship between the to-be-written residual data and the buffer depth according to the vector offset coordinate and the search center point; and determine a buffer depth corresponding to the to-be-written residual data according to the second position mapping relationship, to determine the buffer address corresponding to the to-be-written residual data.
In an embodiment, the writing module 904 is further configured to generate a mask corresponding to the buffer index and the buffer address, and write the to-be-written residual data into the corresponding buffer according to the buffer index, the buffer address, and the mask.
All or a part of the modules in the above-mentioned residual data writing apparatus may be implemented by using software, hardware, and a combination thereof. The foregoing modules may be embedded in or independent of a processor in the computer device in a hardware form, or may be stored in a memory in the computer device in a software form, so that the processor may invoke to execute operations corresponding to the foregoing modules.
In an exemplary embodiment, a computer device is provided. The computer device may be a server, and an internal structure diagram of the computer device may be as shown in
A person skilled in the art may understand that the structure shown in
In an exemplary embodiment, a computer device is provided, including a processor and a memory storing a computer program, the processor, when executing the computer program, may implement the following steps of: determining a residual data reading mode including a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time, determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, in which each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses, acquiring a buffer index and a buffer address corresponding to the to-be-written residual data, writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: configuring a residual data reading circuit including two data interfaces configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process, and reading the residual data from the buffer at least once through the two data interfaces of the residual data reading circuit.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: determining residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process according to the residual data reading mode, to configure two buffer groups, and configuring the same number of buffers in each buffer group.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: partitioning initial residual data acquired in the motion estimation target phase to obtain 16-bit to-be-written residual data; acquiring a vector coordinate corresponding to the to-be-written residual data according to a positional relationship between the to-be-written residual data and the initial residual data; acquiring a search center point corresponding to the initial residual data; obtaining a vector offset coordinate of the to-be-written residual data according to an offset between the vector coordinate and the search center point; and acquiring the buffer index and the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: concatenating buffer lines of all buffers with the same buffer depth according to the buffer index of each buffer to obtain a concatenated buffer line; acquiring a concatenation width of the concatenated buffer line according to a width of a buffer line of each buffer; determining a first position mapping relationship between the to-be-written residual data and the concatenated buffer line according to the vector offset coordinate and the concatenation width; and determining the buffer group and the buffer corresponding to the to-be-written residual data according to the first position mapping relationship, to determine the buffer index corresponding to the to-be-written residual data.
In an embodiment, the to-be-written residual data may include first residual data and second residual data which correspond to two adjacent motion vectors. The processor, when executing the computer program, may further implement the following steps of: determining a plurality of target buffers having a corresponding relationship according to an arrangement sequence of buffers in each buffer group, in which each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; acquiring a difference parameter according to a buffer index of each target buffer; determining a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data respectively according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, correcting the second buffer index according to the difference parameter to obtain a third buffer index; determining the first buffer index as the buffer index corresponding to the first residual data, and determining the third buffer index as the buffer index corresponding to the second residual data.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: determining a second position mapping relationship between the to-be-written residual data and the buffer depth according to the vector offset coordinate and the search center point; and determining a buffer depth corresponding to the to-be-written residual data according to the second position mapping relationship, to determine the buffer address corresponding to the to-be-written residual data.
In an embodiment, the processor, when executing the computer program, may further implement the following steps of: generating a mask corresponding to the buffer index and the buffer address, and writing the to-be-written residual data into the corresponding buffer according to the buffer index, the buffer address, and the mask.
In an embodiment, a computer readable storage medium is provided, on which a computer program is stored. The computer program, when executed by a processor, may cause the processor to implement the following steps of: determining a residual data reading mode including a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time, determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, in which each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses, acquiring a buffer index and a buffer address corresponding to the to-be-written residual data, writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: configuring a residual data reading circuit including two data interfaces configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process, and reading the residual data from the buffer at least once through the two data interfaces of the residual data reading circuit.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: are further implemented: determining residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process according to the residual data reading mode, to configure two buffer groups, and configuring the same number of buffers in each buffer group.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: partitioning initial residual data acquired in the motion estimation target phase to obtain 16-bit to-be-written residual data; acquiring a vector coordinate corresponding to the to-be-written residual data according to a positional relationship between the to-be-written residual data and the initial residual data; acquiring a search center point corresponding to the initial residual data; obtaining a vector offset coordinate of the to-be-written residual data according to an offset between the vector coordinate and the search center point; and acquiring the buffer index and the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: concatenating buffer lines of all buffers with the same buffer depth according to the buffer index of each buffer to obtain a concatenated buffer line; acquiring a concatenation width of the concatenated buffer line according to a width of a buffer line of each buffer; determining a first position mapping relationship between the to-be-written residual data and the concatenated buffer line according to the vector offset coordinate and the concatenation width; and determining the buffer group and the buffer corresponding to the to-be-written residual data according to the first position mapping relationship, to determine the buffer index corresponding to the to-be-written residual data.
In an embodiment, the to-be-written residual data may include first residual data and second residual data which correspond to two adjacent motion vectors. The computer program, when executed by the processor, may further cause the processor to implement the following steps of: determining a plurality of target buffers having a corresponding relationship according to an arrangement sequence of buffers in each buffer group, in which each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; acquiring a difference parameter according to a buffer index of each target buffer; determining a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data respectively according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, correcting the second buffer index according to the difference parameter to obtain a third buffer index; determining the first buffer index as the buffer index corresponding to the first residual data, and determining the third buffer index as the buffer index corresponding to the second residual data.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: determining a second position mapping relationship between the to-be-written residual data and the buffer depth according to the vector offset coordinate and the search center point; and determining a buffer depth corresponding to the to-be-written residual data according to the second position mapping relationship, to determine the buffer address corresponding to the to-be-written residual data.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: generating a mask corresponding to the buffer index and the buffer address, and writing the to-be-written residual data into the corresponding buffer according to the buffer index, the buffer address, and the mask.
In an embodiment, a computer program product is provided, including a computer program. The computer program, when executed by a processor, may cause the processor to implement the following steps of: determining a residual data reading mode including a reading sequence of each piece of residual data, and the quantity of residual data read simultaneously at each time, determining the number of buffer groups and the number of buffers in each buffer group according to the residual data reading mode, in which each buffer is provided with a unique buffer index, and each buffer includes a plurality of buffer addresses, acquiring a buffer index and a buffer address corresponding to the to-be-written residual data, writing the to-be-written residual data into a corresponding buffer according to the buffer index and the buffer address.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: configuring a residual data reading circuit including two data interfaces configured to simultaneously read residual data corresponding to two adjacent motion vectors in each residual data reading process, and reading the residual data from the buffer at least once through the two data interfaces of the residual data reading circuit.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: determining residual data corresponding to two adjacent motion vectors read simultaneously in each residual data reading process according to the residual data reading mode, to configure two buffer groups, and configuring the same number of buffers in each buffer group.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: partitioning initial residual data acquired in the motion estimation target phase to obtain 16-bit to-be-written residual data; acquiring a vector coordinate corresponding to the to-be-written residual data according to a positional relationship between the to-be-written residual data and the initial residual data; acquiring a search center point corresponding to the initial residual data; obtaining a vector offset coordinate of the to-be-written residual data according to an offset between the vector coordinate and the search center point; and acquiring the buffer index and the buffer address corresponding to the to-be-written residual data according to the vector offset coordinate.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: concatenating buffer lines of all buffers with the same buffer depth according to the buffer index of each buffer to obtain a concatenated buffer line; acquiring a concatenation width of the concatenated buffer line according to a width of a buffer line of each buffer; determining a first position mapping relationship between the to-be-written residual data and the concatenated buffer line according to the vector offset coordinate and the concatenation width; and determining the buffer group and the buffer corresponding to the to-be-written residual data according to the first position mapping relationship, to determine the buffer index corresponding to the to-be-written residual data.
In an embodiment, the to-be-written residual data may include first residual data and second residual data which correspond to two adjacent motion vectors. The computer program, when executed by the processor, may further cause the processor to implement the following steps of: determining a plurality of target buffers having a corresponding relationship according to an arrangement sequence of buffers in each buffer group, in which each of the target buffers belongs to a different buffer group, and the target buffers have the same arrangement sequence in respective corresponding buffer groups; acquiring a difference parameter according to a buffer index of each target buffer; determining a buffer group and a buffer corresponding to the first residual data, and a buffer group and a buffer corresponding to the second residual data respectively according to the first position mapping relationship, to determine a first buffer index corresponding to the first residual data and a second buffer index corresponding to the second residual data; when the first buffer index is the same as the second buffer index, correcting the second buffer index according to the difference parameter to obtain a third buffer index; determining the first buffer index as the buffer index corresponding to the first residual data, and determining the third buffer index as the buffer index corresponding to the second residual data.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: determining a second position mapping relationship between the to-be-written residual data and the buffer depth according to the vector offset coordinate and the search center point; and determining a buffer depth corresponding to the to-be-written residual data according to the second position mapping relationship, to determine the buffer address corresponding to the to-be-written residual data.
In an embodiment, the computer program, when executed by the processor, may further cause the processor to implement the following steps of: generating a mask corresponding to the buffer index and the buffer address, and writing the to-be-written residual data into the corresponding buffer according to the buffer index, the buffer address, and the mask.
It should be noted that user information (including but not limited to user device information, user personal information, and the like) and data (including but not limited to data used for analysis, stored data, and displayed data) involved in the present disclosure are authorized by a user or fully authorized by each party, and collection, use, and processing of related data need to comply with a related regulation.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
Those of ordinary skill in the art can understand that all or part of the procedures in the method of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed, the procedures in the above-mentioned method embodiments can be performed. Any reference to a memory, a database or other media used in the various embodiments provided in the present disclosure may include at least one of a non-transitory memory and a transitory memory. The non-transitory memory may include a read-only memory (ROM), a magnetic tape, a floppy disk, a flash memory, an optical memory, a high-density embedded non-transitory memory, a resistive memory (ReRAM), a magnetoresistive random access memory (MRAM), a ferroelectric random access memory (FRAM), a phase change memory (PCM), a graphene memory, etc. The transitory memory may include a random access memory (RAM) or an external cache memory, and the like. As an illustration and not a limitation, the RAM may be in various forms, such as a static random access memory (SRAM) or a dynamic random access memory (DRAM). The database involved in the various embodiments provided in the present disclosure may include at least one of a relational database and a non-relational database. The non-relational database may include a tilechain-based distributed database, etc., but is not limited thereto. The processor involved in the various embodiments provided in the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computation, etc., but is not limited thereto.
The technical limitations in the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical limitations in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical limitations, theses combinations considered to fall within the scope of the present disclosure.
The above-mentioned embodiments merely some exemplary embodiments of the present disclosure, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the present disclosure. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present disclosure, which all belong to the protection scope of the present disclosure. Therefore, the scope of protection of the present disclosure is subject to the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
202311146051.0 | Sep 2023 | CN | national |