WO2019227447A1 - 数据处理方法和处理电路 - Google Patents

数据处理方法和处理电路 Download PDF

Info

Publication number
WO2019227447A1
WO2019227447A1 PCT/CN2018/089404 CN2018089404W WO2019227447A1 WO 2019227447 A1 WO2019227447 A1 WO 2019227447A1 CN 2018089404 W CN2018089404 W CN 2018089404W WO 2019227447 A1 WO2019227447 A1 WO 2019227447A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
input data
data
value
pixel values
Prior art date
Application number
PCT/CN2018/089404
Other languages
English (en)
French (fr)
Inventor
赵尧
谷骞
韩峰
Original Assignee
深圳市大疆创新科技有限公司
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 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2018/089404 priority Critical patent/WO2019227447A1/zh
Priority to CN201880011485.0A priority patent/CN110313015A/zh
Publication of WO2019227447A1 publication Critical patent/WO2019227447A1/zh
Priority to US17/105,401 priority patent/US20210082082A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0007Image acquisition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/60Memory management

Definitions

  • the present invention relates to the field of image processing technology, and in particular, to a data processing method and a processing circuit.
  • FIG. 1A an example of a convolution without padding, with a convolution kernel size of 3 * 3, and a stride of 1 can be found from FIG. 1A.
  • the size is 5 * 5.
  • the size of the output feature map becomes 3 * 3.
  • an outer padding operation may also be performed on the input feature map, for example, a zero padding operation is performed on the edge of the input feature map.
  • FIG. 1B which is a schematic diagram of adding one zero to each edge of the input feature map
  • FIG. 1C which is a schematic diagram of adding two zeros to each of the edge of the input feature map
  • the invention provides a data processing method and a processing circuit, which can reduce the processing load of a CPU.
  • a data processing method includes:
  • a data processing method includes:
  • the pixel values stored in the sub-storage queue are output.
  • a processing circuit includes:
  • a selection sub-circuit configured to obtain a first value according to a byte offset and a data length of the first input data, the first value includes N bits, and each bit value is a first identifier or a second identifier, Each bit corresponds to a storage queue;
  • a first shift sub-circuit configured to obtain second input data according to a byte offset and the first input data, and each sub-data included in the second input data corresponds to a bit in the first value;
  • a storage queue configured to store, in the storage queue corresponding to the bit whose value is the first identifier, the sub-data corresponding to the bit whose value is the first identifier in the second input data;
  • a processing circuit includes:
  • An asymmetric storage queue configured to receive third input data, where the third input data includes image pixel values and padding pixel values; and the third input data is stored in multiple sub storage queues included in the asymmetric storage queue Pixel value of
  • An output selection sub-circuit is used to read the pixel values stored in the sub-storage queue and output the pixel values stored in the sub-storage queue when the data output conditions are satisfied.
  • the outer filling operation (such as zero-padding operation at the edge of the input feature map) can be completed by the processing circuit, without the need for the CPU to implement the outer filling operation, thereby reducing the CPU load. Perform outer filling operations more efficiently and improve processing efficiency.
  • 1A-1D are schematic diagrams of performing external filling on an input feature map
  • FIG. 2 is a schematic diagram of an embodiment of a data processing method
  • FIG. 3 is a schematic diagram of an application scenario of an outer filling embodiment
  • FIG. 4 is a schematic diagram of another embodiment of a data processing method
  • FIG. 5A and FIG. 5B are schematic diagrams of infilling an input feature map
  • 6A-6C are schematic diagrams of an application scenario of an inner filling embodiment.
  • first, second, third, etc. may be used in the present invention to describe various information, these information should not be limited to these terms. These terms are used to distinguish the same type of information from each other.
  • first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information.
  • word “if” can be interpreted as “at”, or “at ", or "in response to a determination”.
  • a data processing method is provided in an embodiment of the present invention, which is used to implement a variable input length alignment output function (such as an outer padding operation, such as performing a zero padding operation on the edge of an input feature map), as shown in FIG. 2.
  • a variable input length alignment output function such as an outer padding operation, such as performing a zero padding operation on the edge of an input feature map
  • FIG. 2 A schematic flowchart of the data processing method. The method may include the following steps:
  • Step 201 Obtain first input data and a data length of the first input data.
  • the first input data may include, but is not limited to, image pixel values; and / or, padding pixel values.
  • Step 202 Obtain a first value according to the byte offset and the data length.
  • the first value includes N bits, and the value of each bit is the first identifier (such as 1) or the second identifier (such as 0).
  • Each bit corresponds to one storage queue, that is, there are N storage queues, and each bit corresponds to one storage queue.
  • obtaining the first value according to the byte offset and the data length may include: converting the data length to a second value of N bits, and each bit of the second value is a first identifier. Or the second identifier; offsetting the second value according to the byte offset to obtain the first value.
  • the converting the data length into a second value of N bits may include: based on the data length M (that is, the data length is M), setting the last M bits of the second value as the first identifier and setting the second value The first NM bits are set as the second identifier; where M may be less than or equal to N.
  • offsetting the second value according to the byte offset to obtain the first value may include: determining the first offset number according to the byte offset, and cyclically shifting each bit in the second value to the left
  • the first offset is a number of bits to obtain a first value.
  • the first offset number may be a byte offset.
  • Step 203 Obtain second input data according to the byte offset and the first input data. Each sub-data included in the second input data corresponds to one bit in the first value.
  • obtaining the second input data according to the byte offset and the first input data may include, but is not limited to, determining the second offset number according to the byte offset, and each of the first input data The sub-data is cyclically left-shifted by the second offset number of bits to obtain second input data.
  • the second offset number may include a product of the byte offset and a specific value.
  • the byte offset before obtaining the first value according to the byte offset and the data length, the byte offset can also be read from the offset register; and obtained according to the byte offset and the first input data. Before the second input data, the byte offset can also be read from the offset register.
  • the offset register is used to record the byte offset, and the byte offset recorded by the offset register is less than or equal to N.
  • the byte length in the offset register may be added to the data length to obtain a new byte offset. And then the resulting byte offset can be updated to the offset register.
  • Step 204 Select the sub-data corresponding to the bit whose value is the first identifier from the second input data, and store the selected sub-data in the storage queue corresponding to the bit.
  • Step 205 When the data output condition is satisfied, output the sub data stored in the storage queue.
  • the sub-data stored in the output storage queue may include, but is not limited to, sub-data can be read from each storage queue of all storage queues, and the read sub-data can be output.
  • the storage queue may be an asymmetric storage queue, and the storage queue may include, but is not limited to, a FIFO (First Input First Out Out) queue.
  • FIFO First Input First Out Out
  • the outer filling operation (such as zero-padding operation at the edge of the input feature map) can be completed by the processing circuit, without the need for the CPU to implement the outer filling operation, thereby reducing the CPU load. Perform outer filling operations more efficiently and improve processing efficiency.
  • a data processing method is provided in the embodiment of the present invention, which can be applied to a processing circuit for implementing functions of variable input length alignment output (such as an outer padding operation, such as zero padding operation at the edge of an input feature map), to achieve An asymmetric storage queue structure with variable transmission length and strong scalability.
  • variable input length alignment output such as an outer padding operation, such as zero padding operation at the edge of an input feature map
  • the processing circuit may include a first shift sub-circuit, a storage queue, a byte enable sub-circuit, a second shift sub-circuit, and an offset register.
  • the storage queue may be an asymmetric storage queue, such as a FIFO queue. Wait.
  • the number of storage queues is N
  • the output data is aligned with N bytes, that is, the number of storage queues can be configured according to the number of bytes of output data
  • the data bit width of each storage queue is 1 byte.
  • the depth is greater than or equal to 2.
  • the number of storage queues is 16
  • the number of storage queues is 8, and so on, and there is no limitation on this. 16 is taken as an example.
  • the offset register (ofst_reg) is used to record the byte offset of the current input data, and after the byte offset is accumulated to the data length of the current input data, a new byte offset is obtained.
  • the new byte offset can be used as the byte offset of the next input data, that is, the byte offset in the offset register is replaced with the new byte offset.
  • the byte offset recorded by the offset register is less than or equal to N. Once the byte offset overflows, the byte offset can be inverted.
  • the byte enable sub-circuit ie, byte enable generation logic
  • the byte enable sub-circuit is used to convert the data length to a second value of N bits, and each bit of the second value is a first identifier. (Such as 1) or the second identifier (such as 0); specifically, if the data length is M, the last M bits of the second value are set as the first identifier, and the first NM bits of the second value are set as The second logo.
  • the second shift sub-circuit (ie, the cyclic shift sub-circuit 1) is used to read the byte offset from the offset register, and offset the second value according to the byte offset.
  • the first value For example, the first offset number (that is, the byte offset) may be determined according to the byte offset, and each bit in the second value is cyclically left shifted by the first offset number of bits to obtain First value.
  • the second value is 0000000000000001 and the byte offset is 1, that is, the first offset number is 1, then each bit in 0000000000000001 is rotated left by 1 bit to obtain the first value of 0000000000000010; if the first value is If the number of offsets is 2, the first value is 0000000000000100.
  • the second value is 0111111111111111 and the byte offset is 1, that is, the first offset number is 1, then each bit in 0111111111111 is rotated to the left by 1 bit to obtain the first value 1111111111110; if the An offset number is 2 and the first value is 1111111111111101.
  • the write enable bus of the storage queue can also be generated according to the first value, and the write enable bus is used to determine which storage queues need to write data.
  • the bit of identification 1 corresponds to storage queue 1. Therefore, the write enable bus is used to make storage queue 1 need to write data; when the first value is 0000000000000010, the identification The 1 bit corresponds to the storage queue 2. Therefore, the write enable bus is used to make the storage queue 2 need to write data.
  • the bit of the identifier 1 corresponds to the storage queue 1 and the storage queue 2.
  • the write enable bus is used to enable the storage queue 1 and the storage queue 2 to write data;
  • the first value is 1100000000000000
  • the bit of the identification 1 corresponds to the storage queue 15 and the storage queue 16
  • the write enable bus is used to enable the storage queue 15 and the storage queue 16 to write data.
  • the bit of the identification 1 corresponds to the storage queue 1-the storage queue 16
  • the write enable bus is used to enable the storage queue 1-the storage queue 16 to write data.
  • the first shift sub-circuit ie, the cyclic shift sub-circuit 2 is used to read the byte offset from the offset register and input the data according to the byte offset (for convenience of differentiation, This is referred to as the first input data) and converted into second input data (for convenience of distinction, it is referred to as second input data), and each sub-data included in the second input data corresponds to one bit in the first value.
  • a second offset number may be determined according to a byte offset, and each sub-data in the first input data is cyclically left shifted by the second offset number of bits to obtain the second input data.
  • the first input data and the second input data can be hexadecimal data, binary data, or decimal data. There is no limitation on this. The following uses hexadecimal as an example. .
  • the first input data may include image pixel values; and / or, outer padding pixel values.
  • the second offset number may include a product of a byte offset and a specific value (such as 8).
  • the first input data is hexadecimal 0x3322
  • each byte is a sub data, such as sub data 22 is 1 byte, a total of 8 bits
  • sub data 33 is 1 byte, a total of 8 bits .
  • the second offset is 1 * 8 bits, that is, 1 byte.
  • the second is obtained.
  • the input data is 0x332200.
  • the second offset is 2 * 8 bits, that is, 2 bytes.
  • the second The input data is 0x33220000. In 0x33220000, the first subdata is subdata 00, the second subdata is subdata 00, the third subdata is subdata 22, and the fourth subdata is subdata 33.
  • the first sub data 00 corresponds to the first bit of the first value (that is, the identifier 1)
  • the second sub data 00 corresponds to the first value of the first value.
  • the third subdata 22 corresponds to the third bit (ie identification 0) of the first value
  • the fourth subdata 33 corresponds to the fourth bit (ie identification 0) of the first value.
  • the write data bus of the storage queue can also be generated according to the second input data, and the write data bus is used to determine which data needs to be written.
  • the sub-data corresponding to the bit whose value is the first identifier (such as 1) may be selected from the second input data, and the selected sub-data may be stored in the storage queue corresponding to the bit.
  • the value of the first identification 1 bit can include the third bit and the fourth bit, and the first Three bits can correspond to the third subdata 22, the fourth bit corresponds to the four subdata 33, and the third bit corresponds to the storage queue 3, and the fourth bit corresponds to the storage queue 4, so the subdata 22 is written to the storage Queue 3 writes sub-data 33 to storage queue 4.
  • the storage queue on the output side of the storage queue, if it is detected that the data output conditions are met (for example, all storage queues store subdata, that is, all storage queues are not empty), it means that each storage queue has at least 1 valid word Section, you can enable the read enable of all the storage queues, and read out the sub-data in all the storage queues at the same time (only 1 byte is read), and these read sub-data complete the alignment operation.
  • the outer filling operation (such as zero-padding operation at the edge of the input feature map) can be completed by the processing circuit, without the need for the CPU to implement the outer filling operation, thereby reducing the CPU load. Perform outer filling operations more efficiently and improve processing efficiency.
  • the first input data is 0x11, and the data length of the first input data is 1, which indicates that the length of the first input data is 1 byte, that is, 8 bits.
  • the first input data 0x11 may be an image pixel value (that is, an effective value) of the input feature map, an outer padding pixel value (such as a padding value of 0) of the input feature map, or an image pixel value and an outer padding of the input feature map Pixel value, which is not limited.
  • the second value is 0000000000000001. If the byte offset currently stored in the offset register is 0, each bit in the second value is rotated left by 0 bits to get the first The value 0000000000000001 means that the write enable bus is 0000000000000001.
  • the second offset number can be 0 * 8, that is, the second offset number is 0.
  • the first input data 0x11 After the sub-data is shifted left by 0 bits, the second input data 0x11 is obtained, that is, the write data bus can be 0x11.
  • the bit whose value is the first identifier 1 is the first bit, and the first bit may correspond to the first sub data 0x11, and the first bit may correspond to the storage queue 1, therefore, subdata 0x11 can be written to storage queue 1.
  • the byte offset stored in the offset register can also be adjusted to 1, that is, the sum of the byte offset 0 currently stored and the data length 1 of the current first input data.
  • the first input data is 0x3322, and the data length of the first input data is 2, which indicates that the length of the first input data is 2 bytes, that is, 16 bits, and the byte offset is 1.
  • the write enable bus can be 0000000000000110.
  • the second offset number can be 1 * 8, that is, the second offset number is 8.
  • Each sub-data in the first input data is 0x3322 After circularly shifting 8 bits to the left, the second input data 0x332200 is obtained, that is, the write data bus is 0x332200.
  • the bit whose value is the first identifier 1 is the second bit and the third bit, and the second bit may correspond to the second sub data 0x22 and the storage queue 2, the The three bits can correspond to the third sub data 0x33 and the storage queue 3. Therefore, the sub data 0x22 is written to the storage queue 2 and the sub data 0x33 is written to the storage queue 3.
  • the byte offset stored in the offset register can also be adjusted to 3, that is, the sum of the byte offset 1 currently stored and the data length 2 of the current first input data.
  • the data length of the first input data is 16, which means that the length is 16 bytes, and the byte offset is 3.
  • the write enable bus can be 1111111111111111.
  • the second offset number can be 3 * 8, that is, the second offset number is 24.
  • Each sub-data in the first input data is 0xffeeddccbbaa99887766554433221100
  • the second input data 0xccbbaa99887766554433221100ffeedd is obtained, which is a write data bus.
  • the bit whose value is the first identification 1 may be the 1st to 16th bits, and the first bit may correspond to the first sub data 0xdd and the storage queue 1, so it is possible to Write the sub data 0xdd to the storage queue 1.
  • the second bit can correspond to the second sub data 0xee and the storage queue 2. Therefore, the sub data 0xee can be written to the storage queue 2.
  • the third bit can correspond to the third sub data. Data 0xff and storage queue 3, therefore, subdata 0xff can be written to storage queue 3, and so on.
  • the 16th bit can correspond to the sixteenth subdata 0xcc and storage queue 16. Therefore, subdata 0xcc can be written. Into the storage queue 16.
  • the byte offset stored in the offset register can also be adjusted to 3, that is, the sum of the currently stored byte offset 3 and the data length 16 of the first input data. Among them, since the sum of 3 and 16 is 19, and 19 is greater than 16, 19 is turned into 3 (that is, 19-16).
  • storage queue 1-storage queue 3 have 2 valid bytes
  • storage queue 4-storage queue 16 have 1 valid byte, which meets the output conditions and enables all storage queues Read enable, therefore, read subdata 0x11 from storage queue 1, read subdata 0x22 from storage queue 2, read subdata 0x33 from storage queue 3, and read subdata 0x00 from storage queue 4.
  • Read the sub data 0x11 from the storage queue 5 read the sub data 0x22 from the storage queue 6, and so on, read the sub data 0xcc from the storage queue 16.
  • a data processing method is provided, which is used to implement the function of variable input length alignment output (such as an inner padding operation, such as performing a zero-padding operation inside the input feature map), as shown in FIG. 4.
  • a schematic flowchart of the data processing method. The method may include the following steps:
  • Step 401 Obtain third input data, and the third input data includes an image pixel value (that is, a valid value in the input feature map) and an inner pixel value (that is, a fill value for the input feature map).
  • Step 402 Output the third input data to an asymmetric storage queue, and store the pixel values in the third input data through a plurality of sub storage queues included in the asymmetric storage queue.
  • the third input data may include R image pixel values, and each image pixel value includes S inner padding pixel values; and the asymmetric storage queue includes S + 1 sub storage queues.
  • the storing of the pixel values in the third input data by using multiple sub storage queues included in the asymmetric storage queue may include: storing R pixel values in the third input data through each of the sub storage queues. Moreover, different sub storage queues are used to store pixel values at different positions in the third input data.
  • Step 403 When the data output condition is satisfied, output the pixel value stored in the sub storage queue.
  • the pixel values stored in the output sub-storage queue may include, but are not limited to, the pixel values may be read from each sub-storage queue of all sub-storage queues, and the read pixel values may be output.
  • reading pixel values from each sub-storage queue of all sub-storage queues and outputting the read pixel values may further include but is not limited to: in the order of each sub-storage queue (Sequence), traverse each sub-storage queue of all sub-storage queues in sequence, read R pixel values from the currently traversed sub-storage queue, and output the read R pixel values.
  • the asymmetric storage queue includes, but is not limited to, an asymmetric FIFO (First Input First Out) queue;
  • the sub storage queue includes, but is not limited to, a sub FIFO queue.
  • the inner circuit can be completed by the processing circuit (such as a zero-padding operation inside the input feature map), and the inner circuit does not need to be implemented by the CPU, thereby reducing the burden on the CPU.
  • the inner filling operation is performed more efficiently and the processing efficiency is improved.
  • An embodiment of the present invention proposes a data processing method, which can be applied to a processing circuit for implementing functions of variable input length alignment output (such as an inner padding operation, such as performing a zero-padding operation inside an input feature map) to achieve An asymmetric storage queue structure with variable transmission length and strong scalability.
  • variable input length alignment output such as an inner padding operation, such as performing a zero-padding operation inside an input feature map
  • FIG. 5A it is a schematic diagram of inverse convolution operation when stride is equal to 1.
  • stride is greater than 1
  • the convolution kernel of inverse convolution becomes a convolution with a 'hole', which is a microstep.
  • Convolution so that the step size of transposed convolution becomes 1 / i times that of forward convolution, and the convolution kernel will move at a smaller step.
  • FIG. 5B when stride is greater than 1, some zeros need to be interpolated between the input feature maps to obtain the output feature map, and the operation of interpolating some zeros is an inner padding operation.
  • the processing load of the CPU is greatly increased, and the processing efficiency is very low.
  • the processing circuit realizes the function of variable input length alignment output (such as an inner padding operation, such as zero-padding operation inside the input feature map), which does not require the CPU to implement the inner padding operation, which reduces The CPU is burdened to perform the inner filling operation more efficiently and improve the processing efficiency.
  • variable input length alignment output such as an inner padding operation, such as zero-padding operation inside the input feature map
  • the processing circuit may include an asymmetric storage queue and an output selection sub-circuit (that is, output data selection logic).
  • the asymmetric storage queue may be a FIFO queue, and the asymmetric storage queue may include multiple sub storage queues. Each sub storage queue can be a FIFO queue, etc.
  • the input data of the asymmetric storage queue may be the third input data, and the third input data may include R image pixel values I, And each image pixel value includes S inner padding pixel values P.
  • S inner filling pixel values P are filled after each image pixel value I to form a write data bus with a width R * (S + 1) as input data of an asymmetric storage queue (asym_fifo). That is, the third input data includes R image pixel values I, and each image pixel value includes S inner pad pixel values P after it.
  • the read data bus with an asymmetric storage queue output width R automatically completes the aligned output of the inner padding.
  • the asymmetric storage queue includes S + 1 sub-storage queues, and completes the data bit width conversion from input R * (S + 1) to output R.
  • the asymmetric storage queue can be divided by S + 1 is composed of sub storage queues with a bit width of R and a depth of M.
  • the same write enable is used for the input side of each sub-storage queue.
  • the write enable of all sub-storage queues is activated, and each sub-storage queue stores the R bits of the third input data respectively in order. That is, each sub-storage queue stores R pixel values in the third input data, and different sub-storage queues are used to store pixel values at different positions in the third input data, that is, the storage is not repeated.
  • the sub storage queue 1 stores the first R bit (lowest R bit) of the third input data
  • the sub storage queue 2 stores the second R bit of the third input data
  • the sub storage queue S + 1 stores the S + 1th R bit (highest R bit) of the third input data, and guarantees that one clock cycle completes the writing operation of the R * (S + 1) bit data.
  • the output selection sub-circuit may activate each of the sub-storage queues one by one in order, and use the output data of the currently activated sub-storage queue as the output data of the asymmetrical storage queue.
  • each sub-storage queue can be traversed in order, R pixel values are read from the currently traversed sub-storage queue, and the read R pixel values are output.
  • R pixel values are sequentially read out, which is regarded as a read operation of the asymmetric storage queue, so that each sub-storage can be output.
  • the pixel value in the queue that is, the pixel value in the output asymmetric storage queue.
  • the inner circuit can be completed by the processing circuit (such as a zero-padding operation inside the input feature map), and the inner circuit does not need to be implemented by the CPU, thereby reducing the burden on the CPU.
  • the inner filling operation is performed more efficiently and the processing efficiency is improved.
  • the asymmetric storage queue includes 3 (that is, S + 1) sub storage queues.
  • the third input data includes two image pixel values, which are pixel value I1 and pixel value I2 respectively.
  • the two inner padding pixel values after pixel value I1 are pixel value P1 and pixel value P2, and the pixel value I2
  • the two padding pixel values are a pixel value P3 and a pixel value P4, respectively.
  • O represents the pixel value after the inner padding
  • the bit width of the image pixel value, the inner padding pixel value, and the pixel value after the inner padding are all 8 bits.
  • the third input data is aligned according to 2 pixel values, and one inner padding corresponds to two consecutive pixel values, namely pixel value I1 and pixel value I2. After the inner padding, the third input data becomes pixel value I1 and pixel value. P1, pixel value P2, pixel value I2, pixel value P3, and pixel value P4.
  • the output selection sub-circuit first activates the sub-storage queue 1 to read out the pixel value I1 and the pixel value P1, and then activates the sub-storage queue 2 to read out the pixel value P2 and the pixel value I2. Then, the sub memory queue 3 is activated, and the pixel value P3 and the pixel value P4 are read out. In this way, after 3 clock cycles, the filled data can be aligned and output according to 2 pixel values.
  • the entire image after the inner filling can be output in a row.
  • the third input data may be obtained, the third input data may be output to an asymmetric storage queue, and the plurality of sub storage queues included in the asymmetric storage queue may be used to store the third input data.
  • Pixel value when the data output condition is met, the pixel value stored in the sub-storage queue can be output. Further, the output pixel value may be the original data of the input feature map, and the pixel value of the input feature map is the image pixel value of the input feature map.
  • This image pixel value may be used as the first input data, or after the input feature map is overfilled, this image pixel value and the outfill pixel value may be used as the first input data, or after the input feature map is overfilled ,
  • the outer padding pixel value can be used as the first input data, which is not limited.
  • the first input data may be used as the input data of Embodiment 1 to Embodiment 3, which is not limited.
  • an embodiment of the present invention further provides a processing circuit, the processing circuit includes: a selection sub-circuit, configured to obtain a first based on a byte offset and a data length of the first input data A numerical value, where the first numerical value includes N bits, and the value of each bit is a first identifier or a second identifier, and each bit corresponds to a storage queue; a first shift sub-circuit is configured to And the second input data is obtained from the first input data, and each sub-data included in the second input data corresponds to one bit in the first value; a storage queue is configured to store in a storage queue corresponding to the bit value of the first identifier Sub-data in the second input data corresponding to the bit whose value is the first identifier; when the data output condition is satisfied, the sub-data stored in the storage queue is output.
  • a selection sub-circuit configured to obtain a first based on a byte offset and a data length of the first input data A numerical value, where the first numerical value includes N bits,
  • the first input data includes: an image pixel value; and / or, an outer padding pixel value.
  • the selection sub-circuit may specifically include: a byte enable sub-circuit for converting a data length of the first input data into a second value of N bits, where each bit is selected
  • the value may be a first identifier or a second identifier; in addition, a second shift sub-circuit is configured to shift the second value according to a byte offset to obtain a first value.
  • the byte enable sub-circuit converts the data length of the first input data into a second value of N bits, it is specifically used to set the last M bits of the second value to the first value based on the data length M And the first NM bits of the second value are set as the second identifier; M is less than or equal to N.
  • the second shift sub-circuit shifts the second value according to a byte offset, and when the first value is obtained, is specifically used to determine the first offset number according to the byte offset, and Each bit in the second value is cyclically shifted left by the first offset number of bits to obtain the first value.
  • the first offset number includes: the byte offset.
  • the first shift sub-circuit When the first shift sub-circuit obtains the second input data according to the byte offset and the first input data, the first shift sub-circuit is specifically configured to: determine a second offset number according to the byte offset; Each sub-data in the input data is cyclically left shifted by the second offset number of bits to obtain the second input data.
  • the second offset number includes a product of the byte offset and a specific value.
  • the processing circuit further includes: an offset register for recording a byte offset, and the byte offset is less than or equal to N; further, the offset register is further used for converting the recorded byte The offset is output to the selection sub-circuit and the first shift sub-circuit.
  • the offset register is further configured to add the byte offset in the offset register to the data length after the first shift subcircuit obtains the second input data according to the byte offset and the first input data. To obtain a new byte offset, and update the obtained byte offset to the offset register.
  • the subdata can be read from each storage queue of all storage queues Data and output the read sub-data.
  • an embodiment of the present invention further provides a processing circuit, which includes: an asymmetric storage queue for receiving third input data, where the third input data includes image pixel values and infill pixels Value; storing pixel values in the third input data through a plurality of sub storage queues included in the asymmetric storage queue; and an output selection sub-circuit for reading pixels stored in the sub storage queue when a data output condition is satisfied Value, the pixel value stored in the output substorage queue.
  • the third input data includes R image pixel values, and each image pixel value includes S inner pad pixel values; the asymmetric storage queue includes S + 1 sub storage queues.
  • the asymmetric storage queue When the asymmetric storage queue stores pixel values in the third input data through multiple sub storage queues, it is specifically configured to: store R pixel values in the third input data through each sub storage queue, and different sub storage The queue is used to store pixel values at different positions in the third input data.
  • the output selection sub-circuit is further configured to determine that the data output condition is satisfied when it is detected that all sub-storage queues store pixel values; the output selection sub-circuit reads the data stored in the sub-storage queue.
  • the pixel value is specifically used to output the pixel value stored in the sub-storage queue: read the pixel value from each sub-storage queue of all sub-storage queues, and output the read pixel value.
  • the output selection sub-circuit reads pixel values from each sub-storage queue of all sub-storage queues, and outputs the read pixel values specifically for: traversing all sub-sequences sequentially
  • Each sub-storage queue of the storage queue reads R pixel values from the currently traversed sub-storage queue and outputs the read R pixel values.
  • the system, device, module or unit explained in the above embodiments may be implemented by a computer chip or entity, or by a product having a certain function.
  • a typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email sending and receiving device, and a game control Desk, tablet computer, wearable device, or a combination of any of these devices.
  • the embodiments of the present invention may be provided as a method, a system, or a computer program product. Therefore, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • these computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured article including an instruction device,
  • the instruction device implements the functions specified in a flowchart or a plurality of processes and / or a block or a plurality of blocks in the block diagram.
  • These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, and the instructions executed on the computer or other programmable device Provides steps for implementing the functions specified in one or more flowcharts and / or one or more blocks of the block diagrams.

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

一种数据处理方法和处理电路,所述方法包括:获取第一输入数据和第一输入数据的数据长度;根据字节偏移量和所述数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或第二标识;根据字节偏移量和第一输入数据获得第二输入数据;从第二输入数据中选取取值为第一标识的比特对应的子数据,并将选取的子数据存储到所述比特对应的存储队列中;在满足数据输出条件时,输出存储队列中存储的子数据。应用本发明实施例,可以由处理电路来完成外填充操作,而不需要由CPU实现外填充操作,从而可以减轻CPU负担,更高效地进行外填充操作,提高处理效率。

Description

数据处理方法和处理电路 技术领域
本发明涉及图像处理技术领域,尤其涉及数据处理方法和处理电路。
背景技术
在图像的处理过程中,通常会涉及到图像外填充操作。例如,参见图1A所示,为一个没有padding(填充),卷积核的大小为3*3,且stride(步幅)为1的卷积示例,从图1A中可以发现,输入特征图的尺寸为5*5,在没有进行padding的情况下,输出特征图的尺寸变为3*3。为了获得与输入特征图相同尺寸的输出特征图,还可以对输入特征图进行外填充操作,例如,在输入特征图的边缘进行补零操作。例如,参见图1B所示,为对输入特征图的边缘各补1个零的示意图;参见图1C所示,为对输入特征图的边缘各补2个零的示意图;参见图1D所示,为对输入特征图的边缘各补任意个零的示意图。
在图像的处理过程中,如果由CPU(Central Processing Unit,中央处理器)完成上述外填充操作,则会大幅增加CPU的处理负担,且处理效率很低。
发明内容
本发明提供一种数据处理方法和处理电路,可以减轻CPU的处理负担。
本发明第一方面,提供一种数据处理方法,所述方法包括:
获取第一输入数据和所述第一输入数据的数据长度;
根据字节偏移量和所述数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或第二标识,每个比特对应一个存储队列;
根据字节偏移量和所述第一输入数据获得第二输入数据,所述第二输入数据包括的每个子数据对应所述第一数值中的一个比特;
从所述第二输入数据中选取取值为第一标识的比特对应的子数据,并将 选取的所述子数据存储到所述比特对应的存储队列中;
在满足数据输出条件时,输出存储队列中存储的子数据。
本发明第二方面,提供一种数据处理方法,所述方法包括:
获取第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;
将所述第三输入数据输出给非对称存储队列,并通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;
在满足数据输出条件时,输出子存储队列中存储的像素值。
本发明第三方面,提供一种处理电路,所述处理电路包括:
选择子电路,用于根据字节偏移量和第一输入数据的数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或者第二标识,每个比特对应一个存储队列;
第一移位子电路,用于根据字节偏移量和第一输入数据获得第二输入数据,第二输入数据包括的每个子数据对应第一数值中的一个比特;
存储队列,用于在取值为第一标识的比特对应的存储队列中,存储所述第二输入数据中的与所述取值为第一标识的比特对应的子数据;
在满足数据输出条件时,输出存储队列中存储的子数据。
本发明第四方面,提供一种处理电路,所述处理电路包括:
非对称存储队列,用于接收第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;
输出选择子电路,用于在满足数据输出条件时,读取子存储队列中存储的像素值,并输出子存储队列中存储的像素值。
基于上述技术方案,本发明实施例中,可以由处理电路来完成外填充操作(如在输入特征图的边缘进行补零操作),而不需要由CPU实现外填充操作,从而可以减轻CPU负担,更高效地进行外填充操作,提高处理效率。
附图说明
为了更加清楚地说明本发明实施例或者现有技术中的技术方案,下面将对本发明实施例或者现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据本发明实施例的这些附图获得其它的附图。
图1A-图1D是对输入特征图进行外填充的示意图;
图2是一个数据处理方法的实施例示意图;
图3是一个外填充实施例的应用场景示意图;
图4是另一个数据处理方法的实施例示意图;
图5A和图5B是对输入特征图进行内填充的示意图;
图6A-图6C是一个内填充实施例的应用场景示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。另外,在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
本发明使用的术语仅仅是出于描述特定实施例的目的,而非限制本发明。本发明和权利要求书所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。应当理解,本文中使用的术语“和/或”是指包含一个或者多个相关联的列出项目的任何或所有可能组合。
尽管在本发明可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语用来将同一类型的信息彼此区分开。例 如,在不脱离本发明范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,此外,所使用的词语“如果”可以被解释成为“在……时”,或者“当……时”,或者“响应于确定”。
实施例1:
本发明实施例中提出一种数据处理方法,用于实现可变输入长度对齐输出的功能(如外填充操作等,如在输入特征图的边缘进行补零操作),参见图2所示,为该数据处理方法的流程示意图,该方法可以包括以下步骤:
步骤201,获取第一输入数据和该第一输入数据的数据长度。其中,第一输入数据可以包括但不限于:图像像素值;和/或,外填充像素值。
步骤202,根据字节偏移量和该数据长度获得第一数值,第一数值包括N个比特,每个比特的取值为第一标识(如1)或者第二标识(如0),每个比特对应一个存储队列,即存在N个存储队列,每个比特对应一个存储队列。
在一个例子中,根据字节偏移量和该数据长度获得第一数值,可以包括:将数据长度转换为N个比特的第二数值,第二数值的每个比特的取值为第一标识或者第二标识;根据字节偏移量对该第二数值进行偏移,得到第一数值。
其中,将数据长度转换为N个比特的第二数值,可以包括:基于数据长度M(即数据长度为M),将第二数值的后M个比特设置为第一标识,并将第二数值的前N-M个比特设置为第二标识;其中,M可以小于等于N。
其中,根据字节偏移量对该第二数值进行偏移,得到第一数值,可以包括:根据字节偏移量确定第一偏移数,将第二数值中的每个比特循环左移所述第一偏移数个比特,得到第一数值。而且,第一偏移数可以为字节偏移量。
步骤203,根据字节偏移量和第一输入数据获得第二输入数据,该第二输入数据包括的每个子数据对应第一数值中的一个比特。
在一个例子中,根据字节偏移量和第一输入数据获得第二输入数据,可以包括但不限于:根据字节偏移量确定第二偏移数,并将第一输入数据中的 每个子数据循环左移所述第二偏移数个比特,得到第二输入数据。
其中,第二偏移数可以包括:所述字节偏移量与特定数值的乘积。
在上述实施例中,在根据字节偏移量和数据长度获得第一数值之前,还可以从偏移寄存器中读取字节偏移量;在根据字节偏移量和第一输入数据获得第二输入数据之前,也可以从偏移寄存器中读取字节偏移量。其中,偏移寄存器用于记录字节偏移量,偏移寄存器记录的字节偏移量小于等于N。
进一步的,在根据字节偏移量和第一输入数据获得第二输入数据之后,还可以将该偏移寄存器中的字节偏移量累加所述数据长度,从而得到新的字节偏移量,然后,可以将得到的字节偏移量更新到所述偏移寄存器。
步骤204,从所述第二输入数据中选取取值为第一标识的比特对应的子数据,并将选取的所述子数据存储到所述比特对应的存储队列中。
步骤205,在满足数据输出条件时,输出存储队列中存储的子数据。
其中,若检测到所有存储队列均存储有子数据(即所有存储队列均为非空),则可以确定满足数据输出条件,然后输出存储队列中存储的子数据。
其中,输出存储队列中存储的子数据,可以包括但不限于:可以从所有存储队列的每个存储队列中读取子数据,并输出读取的子数据。
在上述实施例中,存储队列可以是非对称存储队列,而且,存储队列可以包括但不限于:FIFO(First Input First Outpu,先入先出)队列。
基于上述技术方案,本发明实施例中,可以由处理电路来完成外填充操作(如在输入特征图的边缘进行补零操作),而不需要由CPU实现外填充操作,从而可以减轻CPU负担,更高效地进行外填充操作,提高处理效率。
实施例2:
本发明实施例中提出一种数据处理方法,可以应用于处理电路,用于实现可变输入长度对齐输出的功能(如外填充操作等,如在输入特征图的边缘进行补零操作),实现一种可变传输长度的非对称存储队列结构,可扩展性强。
参见图3所示,处理电路可以包括第一移位子电路、存储队列、字节使 能子电路、第二移位子电路和偏移寄存器,该存储队列可以是非对称存储队列,如FIFO队列等。其中,存储队列的数量为N,且输出数据按照N字节对齐,也就是说,可以根据输出数据的字节数配置存储队列的数量,每个存储队列的数据位宽为1个字节,深度大于等于2。例如,若按照16字节对齐输出数据,则存储队列的数量为16,若按照8字节对齐输出数据,则存储队列的数量为8,以此类推,对此不做限制,后续以N为16为例进行说明。
参见图3所示,偏移寄存器(ofst_reg)用于记录当前输入数据的字节偏移量,且字节偏移量累加当前输入数据的数据长度后,得到新的字节偏移量,这个新的字节偏移量可以作为下一次输入数据的字节偏移量,即使用新的字节偏移量替换偏移寄存器中的字节偏移量。而且,偏移寄存器记录的字节偏移量小于等于N,一旦字节偏移量溢出,就可以对字节偏移量进行翻转。
参见图3所示,字节使能子电路(即字节使能产生逻辑)用于将数据长度转换为N个比特的第二数值,第二数值的每个比特的取值为第一标识(如1)或者第二标识(如0);具体的,若数据长度为M,则将第二数值的后M个比特设置为第一标识,并将第二数值的前N-M个比特设置为第二标识。
例如,N为16,M为1时,则第二数值为0000000000000001,此外,当M为2时,则第二数值为0000000000000011,当M为3时,则第二数值为0000000000000111,以此类推,当M为16时,则第二数值为1111111111111111。
参见图3所示,第二移位子电路(即循环移位子电路1)用于从偏移寄存器读取字节偏移量,并根据该字节偏移量对第二数值进行偏移,得到第一数值。例如,可以根据字节偏移量确定第一偏移数(即所述字节偏移量),并将第二数值中的每个比特循环左移所述第一偏移数个比特,得到第一数值。
例如,若第二数值为0000000000000001,字节偏移量为1,即第一偏移数为1,则将0000000000000001中的每个比特循环左移1个比特,得到第一数值0000000000000010;若第一偏移数为2,则第一数值为0000000000000100。
又例如,若第二数值为0111111111111111,字节偏移量为1,即第一偏移数为1,则将0111111111111111中的每个比特循环左移1个比特,得到第一数 值1111111111111110;若第一偏移数为2,则第一数值为1111111111111101。
其中,第二移位子电路在得到第一数值后,还可以根据第一数值生成存储队列的写使能总线,而写使能总线用于确定哪些存储队列需要写入数据。
例如,当数据长度为1,第一数值为0000000000000001时,标识1的比特对应存储队列1,因此,写使能总线用于使存储队列1需要写入数据;当第一数值为0000000000000010时,标识1的比特对应存储队列2,因此,写使能总线用于使存储队列2需要写入数据。又例如,当数据长度为2,第一数值为0000000000000011时,标识1的比特对应存储队列1和存储队列2,因此,写使能总线用于使存储队列1和存储队列2需要写入数据;当第一数值为1100000000000000时,标识1的比特对应存储队列15和存储队列16,因此,写使能总线用于使存储队列15和存储队列16需要写入数据。又例如,当数据长度为16,第一数值为1111111111111111时,标识1的比特对应存储队列1-存储队列16,因此写使能总线用于使存储队列1-存储队列16需要写入数据。
参见图3所示,第一移位子电路(即循环移位子电路2)用于从偏移寄存器读取字节偏移量,并根据字节偏移量将输入数据(为了区分方便,将其称为第一输入数据)转换为第二输入数据(为了区分方便,将其称为第二输入数据),该第二输入数据包括的每个子数据对应第一数值中的一个比特。
例如,可以根据字节偏移量确定第二偏移数,并将第一输入数据中的每个子数据循环左移所述第二偏移数个比特,从而得到第二输入数据。
其中,第一输入数据和第二输入数据可以是16进制的数据,也可以是2进制的数据,还可以是10进制的数据,对此不做限制,后续以16进制为例。
其中,第一输入数据可以包括图像像素值;和/或,外填充像素值。
其中,第二偏移数可以包括:字节偏移量与特定数值(如8)的乘积。
例如,第一输入数据为16进制的0x3322,每个字节是一个子数据,如子数据22为1个字节,共8个比特,子数据33为1个字节,共8个比特。
假设字节偏移量为1,则第二偏移数为1*8个比特,即1个字节,将第一输入数据0x3322中的每个子数据循环左移8个比特后,得到第二输入数据 0x332200。假设字节偏移量为2,则第二偏移数为2*8个比特,即2个字节,将第一输入数据0x3322中的每个子数据循环左移16个比特后,得到第二输入数据0x33220000,在0x33220000中,第一个子数据为子数据00,第二个子数据为子数据00,第三个子数据为子数据22,第四个子数据为子数据33。
其中,若第一数值为0000000000000001,从第一数值的低位到高位,第一个子数据00对应第一数值的第一个比特(即标识1),第二个子数据00对应第一数值的第二个比特(即标识0),第三个子数据22对应第一数值的第三个比特(即标识0),第四个子数据33对应第一数值的第四个比特(即标识0)。
其中,第一移位子电路在得到第二输入数据后,还可以根据第二输入数据生成存储队列的写数据总线,而写数据总线用于确定需要写入哪些数据。
在一个例子中,可以从第二输入数据中选取出取值为第一标识(如1)的比特对应的子数据,并可以将选取的子数据存储到该比特对应的存储队列中。
例如,假设第一数值为0000000000001100,第二输入数据为0x33220000,则从第一数值的低位到高位,取值为第一标识1的比特,可以包括第三个比特和第四个比特,而第三个比特可以对应第三个子数据22,第四个比特对应四个子数据33,且第三个比特对应存储队列3,第四个比特对应存储队列4,因此,将子数据22写入到存储队列3,将子数据33写入到存储队列4。
在一个例子中,在存储队列的输出侧,若检测到满足数据输出条件(如所有存储队列均存储有子数据,即所有存储队列非空),则说明每个存储队列至少有1个有效字节,可以使能所有存储队列的读使能,同时读出所有存储队列中的子数据(只读取1个字节),而这些读取的子数据就完成对齐操作。
基于上述技术方案,本发明实施例中,可以由处理电路来完成外填充操作(如在输入特征图的边缘进行补零操作),而不需要由CPU实现外填充操作,从而可以减轻CPU负担,更高效地进行外填充操作,提高处理效率。
实施例3:
在实施例2的基础上,以下结合具体应用场景,对上述数据处理方法进 行详细说明。在本应用场景中,以存储队列的数量N为16为例进行说明。
第一、获取第一输入数据0x11,第一输入数据的数据长度为1,表示第一输入数据的长度为1个字节,即8个比特。第一输入数据0x11可以是输入特征图的图像像素值(即有效值),可以是输入特征图的外填充像素值(如填充值0),还可以是输入特征图的图像像素值和外填充像素值,对此不做限制。
由于数据长度为1,因此,第二数值为0000000000000001,若偏移寄存器当前存储的字节偏移量为0,则将第二数值中的每个比特循环左移0个比特后,得到第一数值0000000000000001,即写使能总线为0000000000000001。
此外,由于第一输入数据为0x11,字节偏移量为0,因此,第二偏移数可以为0*8,即第二偏移数为0,在将第一输入数据0x11中的每个子数据循环左移0个比特后,得到第二输入数据0x11,即写数据总线可以为0x11。
然后,从第一数值0000000000000001的低位到高位,取值为第一标识1的比特为第一个比特,而第一个比特可以对应第一个子数据0x11,且第一个比特可以对应存储队列1,因此,可以将子数据0x11写入到存储队列1。
在一个例子中,还可以将偏移寄存器中存储的字节偏移量调整为1,即当前存储的字节偏移量0与当前的第一输入数据的数据长度1之和。
第二、获取第一输入数据0x3322,第一输入数据的数据长度为2,表示第一输入数据的长度为2个字节,即16个比特,且字节偏移量为1。
由于数据长度为2,因此,第二数值为0000000000000011,又由于字节偏移量为1,因此,在将第二数值中的每个比特循环左移1个比特后,可以得到第一数值0000000000000110,即写使能总线可以为0000000000000110。
由于第一输入数据为0x3322,字节偏移量为1,因此,第二偏移数可以为1*8,即第二偏移数为8,在将第一输入数据0x3322中的每个子数据循环左移8个比特后,得到第二输入数据0x332200,即写数据总线为0x332200。
然后,从第一数值0000000000000110的低位到高位,取值为第一标识1 的比特为第二个比特和第三个比特,而第二个比特可以对应第二个子数据0x22和存储队列2,第三个比特可以对应第三子数据0x33和存储队列3,因此,将子数据0x22写入到存储队列2,将子数据0x33写入到存储队列3。
在一个例子中,还可以将偏移寄存器中存储的字节偏移量调整为3,即当前存储的字节偏移量1与当前的第一输入数据的数据长度2之和。
第三、获取第一输入数据0xffeeddccbbaa99887766554433221100,第一输入数据的数据长度为16,表示长度为16个字节,且字节偏移量为3。
由于数据长度为16,因此,第二数值为1111111111111111,又由于字节偏移量为3,因此,在将第二数值中的每个比特循环左移3个比特后,可以得到第一数值1111111111111111,即写使能总线可以为1111111111111111。
由于第一输入数据为0xffeeddccbbaa99887766554433221100,字节偏移量为3,因此,第二偏移数可以为3*8,即第二偏移数为24,在将第一输入数据0xffeeddccbbaa99887766554433221100中的每个子数据循环左移24个比特后,得到第二输入数据0xccbbaa99887766554433221100ffeedd,其是写数据总线。
然后,从第一数值1111111111111111的低位到高位,取值为第一标识1的比特可以为第1-16个比特,第1个比特可以对应第一个子数据0xdd和存储队列1,因此,可以将子数据0xdd写入到存储队列1,第2个比特可以对应第二个子数据0xee和存储队列2,因此,可以将子数据0xee写入到存储队列2,第3个比特可以对应第三个子数据0xff和存储队列3,因此,可以将子数据0xff写入到存储队列3,以此类推,第16个比特可以对应第十六个子数据0xcc和存储队列16,因此,可以将子数据0xcc写入到存储队列16。
在一个例子中,还可以将偏移寄存器中存储的字节偏移量调整为3,即当前存储的字节偏移量3与当前的第一输入数据的数据长度16之和。其中,由于3与16的和为19,19大于16,因此,将19翻转为3(即19-16)。
经过上述处理后,所有存储队列都会非空,存储队列1-存储队列3有2 个有效字节,而存储队列4-存储队列16有1个有效字节,满足输出条件,使能所有存储队列的读使能,因此,从存储队列1中读取子数据0x11,从存储队列2中读取子数据0x22,从存储队列3中读取子数据0x33,从存储队列4中读取子数据0x00,从存储队列5中读取子数据0x11,从存储队列6中读取子数据0x22,以此类推,从存储队列16中读取子数据0xcc。经过上述处理,就可以同时读出所有存储队列中的子数据,这些读取的子数据完成对齐操作。
实施例4:
本发明实施例中提出一种数据处理方法,用于实现可变输入长度对齐输出的功能(如内填充操作等,如在输入特征图的内部进行补零操作),参见图4所示,为该数据处理方法的流程示意图,该方法可以包括以下步骤:
步骤401,获取第三输入数据,第三输入数据包括图像像素值(即输入特征图中的有效值)和内填充像素值(即针对输入特征图的填充值)。
步骤402,将该第三输入数据输出给非对称存储队列,并通过所述非对称存储队列包括的多个子存储队列存储该第三输入数据中的像素值。
其中,第三输入数据可以包括R个图像像素值,且每个图像像素值后面包括S个内填充像素值;而且,非对称存储队列包括S+1个子存储队列。
通过所述非对称存储队列包括的多个子存储队列存储该第三输入数据中的像素值,可以包括:通过每个子存储队列存储第三输入数据中的R个像素值。而且,不同的子存储队列用于存储第三输入数据中的不同位置的像素值。
步骤403,在满足数据输出条件时,输出子存储队列中存储的像素值。
其中,若检测到所有子存储队列均存储有像素值(即所有子存储队列均为非空),则可以确定满足数据输出条件,并输出子存储队列中存储的像素值。
其中,输出子存储队列中存储的像素值,可以包括但不限于:可以从所有子存储队列的每个子存储队列中读取像素值,并输出读取的像素值。
在一个例子中,从所有子存储队列的每个子存储队列中读取像素值,并 输出读取的像素值,还可以包括但不限于:按照每个子存储队列的顺序(即子存储队列的先后顺序),依次遍历所有子存储队列的每个子存储队列,并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
在上述实施例中,非对称存储队列包括但不限于:非对称FIFO(First Input First Outpu,先入先出)队列;所述子存储队列包括但不限于:子FIFO队列。
基于上述技术方案,本发明实施例中,可以由处理电路来完成内填充操作(如在输入特征图的内部进行补零操作),而不需要由CPU实现内填充操作,从而可以减轻CPU负担,更高效地进行内填充操作,提高处理效率。
实施例5:
本发明实施例中提出一种数据处理方法,可以应用于处理电路,用于实现可变输入长度对齐输出的功能(如内填充操作等,如在输入特征图的内部进行补零操作),实现一种可变传输长度的非对称存储队列结构,可扩展性强。
在图像处理过程中,通常会涉及到图像内填充操作。例如,参见图5A所示,为stride等于1时,逆卷积运算的示意图,当stride大于1时,逆卷积的卷积核就变成一个带‘洞’的卷积,也就是微步卷积,从而使转置卷积的步长变成正向卷积的1/i倍,且卷积核将以一个更小的步伐移动。参见图5B所示,当stride大于1时,就需要在输入特征图间插若干的零,得到输出特征图,而间插若干的零的操作就是内填充操作。在图像处理过程中,如果由CPU完成上述内填充操作,则会大幅增加CPU的处理负担,且处理效率很低。
针对上述发现,本实施例中,由处理电路实现可变输入长度对齐输出的功能(如内填充操作等,如在输入特征图的内部进行补零操作),不需要CPU实现内填充操作,减轻CPU负担,更高效地进行内填充操作,提高处理效率。
参见图6A所示,处理电路可以包括非对称存储队列和输出选择子电路(即输出数据选择逻辑),该非对称存储队列可以是FIFO队列,且该非对称存储队列可以包括多个子存储队列,每个子存储队列均可以为FIFO队列等。
在一个例子中,假设原始图像(如未进行内填充的输入特征图)按照R个图像像素值对齐输入,且每个图像像素值后面可以填充S个内填充像素值 (为了区分方便,可以将图像像素值称为像素值I,将内填充像素值称为像素值P),则非对称存储队列的输入数据可以是第三输入数据,且第三输入数据可以包括R个图像像素值I,且每个图像像素值后面包括S个内填充像素值P。
参见图6B所示,在每个图像像素值I后面填充S个内填充像素值P,组成宽度为R*(S+1)的写数据总线,作为非对称存储队列(asym_fifo)的输入数据,即第三输入数据,第三输入数据包括R个图像像素值I,且每个图像像素值后面包括S个内填充像素值P。此外,非对称存储队列输出宽度为R的读数据总线,就自动完成了内填充的对齐输出。其中,非对称存储队列包括S+1个子存储队列,完成输入R*(S+1)到输出R的数据位宽转换。
具体的,假设非对称存储队列的输入数据(即第三输入数据)的位宽为R*(S+1),非对称存储队列的输出数据的位宽为R,则非对称存储队列可以由S+1个位宽为R,深度为M的子存储队列组成。对于每个子存储队列的输入侧,使用相同的写使能,一旦第三输入数据有效,激活所有子存储队列的写使能,同时每个子存储队列按顺序分别存储第三输入数据的R个比特,也就是说,通过每个子存储队列存储第三输入数据中的R个像素值,且不同的子存储队列用于存储第三输入数据中的不同位置的像素值,即存储不重复。
例如,从第三输入数据的最低比特到最高比特,子存储队列1存储第三输入数据的第一个R比特(最低R比特),子存储队列2存储第三输入数据的第二个R比特,以此类推,子存储队列S+1存储第三输入数据的第S+1个R比特(最高R比特),保证一个时钟周期完成R*(S+1)比特数据的写入操作。
参见图6A和图6B所示,对于每个子存储队列的输出侧,可以使用各自独立的读使能,一旦检测到满足数据输出条件(如所有子存储队列均为非空,且输出无阻塞),则输出选择子电路可以按顺序依次激活每个子存储队列一次,并将当前激活的子存储队列的输出数据作为非对称存储队列的输出数据。
综上所述,可以按照每个子存储队列的顺序,依次遍历每个子存储队列, 并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
在将所有的子存储队列遍历一次后,即从所有子存储队列的每个子存储队列中,依次读出R个像素值,视为非对称存储队列的一次读操作,这样,可以输出每个子存储队列中的像素值,即输出非对称存储队列中的像素值。
基于上述技术方案,本发明实施例中,可以由处理电路来完成内填充操作(如在输入特征图的内部进行补零操作),而不需要由CPU实现内填充操作,从而可以减轻CPU负担,更高效地进行内填充操作,提高处理效率。
实施例6:
在实施例5的基础上,以下结合具体应用场景,对上述数据处理方法进行说明。在本应用场景中,参见图6C所示,以R为2,S为2为例进行说明,非对称存储队列包括3(即S+1)个子存储队列。其中,第三输入数据包括的2个图像像素值,分别为像素值I1和像素值I2,像素值I1后面的2个内填充像素值分别为像素值P1和像素值P2,像素值I2后面的2个内填充像素值分别为像素值P3和像素值P4。在图6C中,O表示内填充后的像素值,而且,上述图像像素值、内填充像素值、内填充后的像素值的位宽都为8比特。
其中,第三输入数据按照2个像素值对齐,一次内填充就对应连续两个像素值,即像素值I1和像素值I2,经过内填充后,第三输入数据变成像素值I1、像素值P1、像素值P2、像素值I2、像素值P3和像素值P4。然后,将像素值I1、像素值P1、像素值P2、像素值I2、像素值P3和像素值P4输入非对称存储队列,则像素值I1和像素值P1写入到子存储队列1,像素值P2和像素值I2写入到子存储队列2,像素值P3和像素值P4写入到子存储队列3。
然后,一旦检测到满足数据输出条件,则输出选择子电路首先激活子存储队列1,读出像素值I1和像素值P1,然后,激活子存储队列2,读出像素值P2和像素值I2,然后,激活子存储队列3,读出像素值P3和像素值P4。这样,经过3个时钟周期就能将内填充后的数据按照2个像素值对齐输出。
进一步的,循环上述操作,就能按行输出内填充后的整幅图像。
实施例7:
在实施例4-实施例6的基础上,可以获取第三输入数据,将第三输入数据输出给非对称存储队列,并通过非对称存储队列包括的多个子存储队列存储第三输入数据中的像素值;在满足数据输出条件时,可以输出子存储队列中存储的像素值。进一步的,输出的像素值可以就是输入特征图的原始数据,而且,这个输入特征图的像素值就是输入特征图的图像像素值。可以将这个图像像素值作为第一输入数据,或者,对输入特征图进行外填充后,可以将这个图像像素值和外填充像素值作为第一输入数据,或者,对输入特征图进行外填充后,可以将外填充像素值作为第一输入数据,对此不做限制。然后,可以将第一输入数据作为实施例1-实施例3的输入数据,对此不做限制。
实施例8:
基于与上述方法同样的发明构思,本发明实施例中还提供一种处理电路,所述处理电路包括:选择子电路,用于根据字节偏移量和第一输入数据的数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或者第二标识,每个比特对应一个存储队列;第一移位子电路,用于根据字节偏移量和第一输入数据获得第二输入数据,第二输入数据包括的每个子数据对应第一数值中的一个比特;存储队列,用于在取值为第一标识的比特对应的存储队列中,存储所述第二输入数据中的与所述取值为第一标识的比特对应的子数据;在满足数据输出条件时,输出存储队列中存储的子数据。
所述第一输入数据包括:图像像素值;和/或,外填充像素值。
在一个例子中,所述选择子电路具体可以包括:字节使能子电路,用于将所述第一输入数据的数据长度转换为N个比特的第二数值,其中,每个比特的取值可以为第一标识或者第二标识;此外,第二移位子电路,用于根据字节偏移量对所述第二数值进行偏移,得到第一数值。
所述字节使能子电路将所述第一输入数据的数据长度转换为N个比特的第二数值时具体用于:基于数据长度M,将第二数值的后M个比特设置为第一标识,并将所述第二数值的前N-M个比特设置为第二标识;M小于等于N。
所述第二移位子电路根据字节偏移量对所述第二数值进行偏移,得到第一数值时具体用于:根据所述字节偏移量确定第一偏移数,并将所述第二数值中的每个比特循环左移所述第一偏移数个比特,得到所述第一数值。
所述第一偏移数包括:所述字节偏移量。
所述第一移位子电路根据字节偏移量和第一输入数据获得第二输入数据时具体用于:根据所述字节偏移量确定第二偏移数,并将所述第一输入数据中的每个子数据循环左移所述第二偏移数个比特,得到所述第二输入数据。
所述第二偏移数包括:所述字节偏移量与特定数值的乘积。
所述处理电路,还包括:偏移寄存器,用于记录字节偏移量,且所述字节偏移量小于等于N;进一步的,所述偏移寄存器,还用于将记录的字节偏移量输出给所述选择子电路和所述第一移位子电路。
所述偏移寄存器,还用于在第一移位子电路根据字节偏移量和第一输入数据获得第二输入数据后,将偏移寄存器中的字节偏移量累加所述数据长度,得到新的字节偏移量,并将得到的字节偏移量更新到所述偏移寄存器。
在一个例子中,若所有存储队列均存储有子数据,则确定满足数据输出条件;进一步的,在输出存储队列中存储的子数据时,可以从所有存储队列的每个存储队列中读取子数据,并输出读取的子数据。
实施例9:
基于与上述方法同样的发明构思,本发明实施例中还提供一种处理电路,包括:非对称存储队列,用于接收第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;输出选择子电路,用于在满足数据输出条件时,读取子存储队列中存储的像素值,输出子存储队列中存储的像素值。
所述第三输入数据包括R个图像像素值,每个图像像素值后面包括S个内填充像素值;所述非对称存储队列包括S+1个子存储队列。
所述非对称存储队列通过多个子存储队列存储所述第三输入数据中的像素值时具体用于:通过每个子存储队列存储所述第三输入数据中的R个像素值,不同的子存储队列用于存储所述第三输入数据中的不同位置的像素值。
在一个例子中,所述输出选择子电路,还用于当检测到所有子存储队列均存储有像素值时,则确定满足数据输出条件;所述输出选择子电路读取子存储队列中存储的像素值,并输出子存储队列中存储的像素值时具体用于:从所有子存储队列的每个子存储队列中读取像素值,并输出读取的像素值。
在一个例子中,所述输出选择子电路从所有子存储队列的每个子存储队列中读取像素值,并输出读取的像素值时具体用于:按照子存储队列的顺序,依次遍历所有子存储队列的每个子存储队列,并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
上述实施例阐明的系统、装置、模块或单元,可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本发明时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本发明实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产 品的流程图和/或方框图来描述的。应理解可以由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其它可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其它可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
而且,这些计算机程序指令也可以存储在能引导计算机或其它可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或者多个流程和/或方框图一个方框或者多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其它可编程数据处理设备,使得在计算机或者其它可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其它可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上所述仅为本发明实施例而已,并不用于限制本发明。对于本领域技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原理之内所作的任何修改、等同替换、改进,均应包含在本发明的权利要求范围之内。

Claims (46)

  1. 一种数据处理方法,其特征在于,所述方法包括:
    获取第一输入数据和所述第一输入数据的数据长度;
    根据字节偏移量和所述数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或第二标识,每个比特对应一个存储队列;
    根据字节偏移量和所述第一输入数据获得第二输入数据,所述第二输入数据包括的每个子数据对应所述第一数值中的一个比特;
    从所述第二输入数据中选取取值为第一标识的比特对应的子数据,并将选取的所述子数据存储到所述比特对应的存储队列中;
    在满足数据输出条件时,输出存储队列中存储的子数据。
  2. 根据权利要求1所述的方法,其特征在于,
    所述第一输入数据包括:图像像素值;和/或,外填充像素值。
  3. 根据权利要求1所述的方法,其特征在于,
    所述根据字节偏移量和所述数据长度获得第一数值,包括:
    将所述数据长度转换为N个比特的第二数值,每个比特的取值为第一标识或第二标识;根据字节偏移量对所述第二数值进行偏移,得到第一数值。
  4. 根据权利要求3所述的方法,其特征在于,
    所述将所述数据长度转换为N个比特的第二数值,包括:
    基于所述数据长度M,将第二数值的后M个比特设置为第一标识,并将所述第二数值的前N-M个比特设置为第二标识;其中,M小于等于N。
  5. 根据权利要求3所述的方法,其特征在于,
    所述根据字节偏移量对所述第二数值进行偏移,得到第一数值,包括:
    根据所述字节偏移量确定第一偏移数,并将所述第二数值中的每个比特循环左移所述第一偏移数个比特,得到所述第一数值。
  6. 根据权利要求5所述的方法,其特征在于,
    所述第一偏移数包括:所述字节偏移量。
  7. 根据权利要求1所述的方法,其特征在于,
    所述根据字节偏移量和所述第一输入数据获得第二输入数据,包括:
    根据所述字节偏移量确定第二偏移数,并将所述第一输入数据中的每个子数据循环左移所述第二偏移数个比特,得到所述第二输入数据。
  8. 根据权利要求7所述的方法,其特征在于,
    所述第二偏移数包括:所述字节偏移量与特定数值的乘积。
  9. 根据权利要求1所述的方法,其特征在于,
    所述根据字节偏移量和所述数据长度获得第一数值之前,还包括:
    从偏移寄存器中读取字节偏移量;其中,所述偏移寄存器用于记录字节偏移量,且所述偏移寄存器记录的字节偏移量小于等于N。
  10. 根据权利要求9所述的方法,其特征在于,所述根据字节偏移量和所述第一输入数据获得第二输入数据之后,所述方法还包括:
    将所述偏移寄存器中的字节偏移量累加所述数据长度,得到新的字节偏移量,并将得到的字节偏移量更新到所述偏移寄存器。
  11. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    若检测到所有存储队列均存储有子数据,则确定满足数据输出条件。
  12. 根据权利要求1所述的方法,其特征在于,
    所述输出存储队列中存储的子数据,包括:
    从所有存储队列的每个存储队列中读取子数据,并输出读取的子数据。
  13. 根据权利要求1-12任一项所述的方法,其特征在于,
    所述存储队列包括:先入先出FIFO队列。
  14. 根据权利要求1所述的方法,其特征在于,
    所述获取第一输入数据和所述第一输入数据的数据长度之前,还包括:
    获取第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;
    将所述第三输入数据输出给非对称存储队列,并通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;
    在满足数据输出条件时,输出子存储队列中存储的像素值;
    根据输出的像素值获得第一输入数据的图像像素值,并根据第一输入数 据的图像像素值和/或第一输入数据的外填充像素值获得所述第一输入数据。
  15. 根据权利要求14所述的方法,其特征在于,
    所述第三输入数据包括R个图像像素值,每个图像像素值后面包括S个内填充像素值;所述非对称存储队列包括S+1个子存储队列。
  16. 根据权利要求15所述的方法,其特征在于,通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值,包括:
    通过每个子存储队列存储所述第三输入数据中的R个像素值。
  17. 根据权利要求16所述的方法,其特征在于,
    不同的子存储队列用于存储所述第三输入数据中的不同位置的像素值。
  18. 根据权利要求14所述的方法,其特征在于,所述方法还包括:
    若检测到所有子存储队列均存储有像素值,则确定满足数据输出条件。
  19. 根据权利要求14所述的方法,其特征在于,
    所述输出子存储队列中存储的像素值,包括:
    从所有子存储队列的每个子存储队列中读取像素值,输出读取的像素值。
  20. 根据权利要求19所述的方法,其特征在于,所述从所有子存储队列的每个子存储队列中读取像素值,输出读取的像素值,包括:
    按照子存储队列的顺序,依次遍历所有子存储队列的每个子存储队列,并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
  21. 根据权利要求14-20任一所述的方法,其特征在于,所述非对称存储队列包括:非对称先入先出FIFO队列;所述子存储队列包括:子FIFO队列。
  22. 一种数据处理方法,其特征在于,所述方法包括:
    获取第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;
    将所述第三输入数据输出给非对称存储队列,并通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;
    在满足数据输出条件时,输出子存储队列中存储的像素值。
  23. 根据权利要求22所述的方法,其特征在于,
    所述第三输入数据包括R个图像像素值,每个图像像素值后面包括S个 内填充像素值;所述非对称存储队列包括S+1个子存储队列。
  24. 根据权利要求23所述的方法,其特征在于,通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值,包括:
    通过每个子存储队列存储所述第三输入数据中的R个像素值。
  25. 根据权利要求24所述的方法,其特征在于,
    不同的子存储队列用于存储所述第三输入数据中的不同位置的像素值。
  26. 根据权利要求22所述的方法,其特征在于,所述方法还包括:
    若检测到所有子存储队列均存储有像素值,则确定满足数据输出条件。
  27. 根据权利要求22所述的方法,其特征在于,
    所述输出子存储队列中存储的像素值,包括:
    从所有子存储队列的每个子存储队列中读取像素值,输出读取的像素值。
  28. 根据权利要求27所述的方法,其特征在于,所述从所有子存储队列的每个子存储队列中读取像素值,输出读取的像素值,包括:
    按照子存储队列的顺序,依次遍历所有子存储队列的每个子存储队列,并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
  29. 根据权利要求22-28任一所述的方法,其特征在于,所述非对称存储队列包括:非对称先入先出FIFO队列;所述子存储队列包括:子FIFO队列。
  30. 一种处理电路,其特征在于,所述处理电路包括:
    选择子电路,用于根据字节偏移量和第一输入数据的数据长度获得第一数值,所述第一数值包括N个比特,每个比特的取值为第一标识或者第二标识,每个比特对应一个存储队列;
    第一移位子电路,用于根据字节偏移量和第一输入数据获得第二输入数据,第二输入数据包括的每个子数据对应第一数值中的一个比特;
    存储队列,用于在取值为第一标识的比特对应的存储队列中,存储所述第二输入数据中的与所述取值为第一标识的比特对应的子数据;
    在满足数据输出条件时,输出存储队列中存储的子数据。
  31. 根据权利要求30所述的处理电路,其特征在于,
    所述第一输入数据包括:图像像素值;和/或,外填充像素值。
  32. 根据权利要求30所述的处理电路,其特征在于,选择子电路包括:
    字节使能子电路,用于将所述第一输入数据的数据长度转换为N个比特的第二数值,每个比特的取值为第一标识或者第二标识;
    第二移位子电路,用于根据字节偏移量对所述第二数值进行偏移,得到第一数值。
  33. 根据权利要求32所述的处理电路,其特征在于,所述字节使能子电路将所述第一输入数据的数据长度转换为N个比特的第二数值时具体用于:
    基于所述数据长度M,将第二数值的后M个比特设置为第一标识,并将所述第二数值的前N-M个比特设置为第二标识;其中,M小于等于N。
  34. 根据权利要求32所述的处理电路,其特征在于,所述第二移位子电路根据字节偏移量对所述第二数值进行偏移,得到第一数值时具体用于:
    根据所述字节偏移量确定第一偏移数,并将所述第二数值中的每个比特循环左移所述第一偏移数个比特,得到所述第一数值。
  35. 根据权利要求34所述的处理电路,其特征在于,
    所述第一偏移数包括:所述字节偏移量。
  36. 根据权利要求30所述的处理电路,其特征在于,所述第一移位子电路根据字节偏移量和第一输入数据获得第二输入数据时具体用于:
    根据所述字节偏移量确定第二偏移数,并将所述第一输入数据中的每个子数据循环左移所述第二偏移数个比特,得到所述第二输入数据。
  37. 根据权利要求36所述的处理电路,其特征在于,
    所述第二偏移数包括:所述字节偏移量与特定数值的乘积。
  38. 根据权利要求30所述的处理电路,其特征在于,还包括:
    偏移寄存器,用于记录字节偏移量,且所述字节偏移量小于等于N;
    所述偏移寄存器,还用于将记录的字节偏移量输出给所述选择子电路和所述第一移位子电路。
  39. 根据权利要求38所述的处理电路,其特征在于,
    所述偏移寄存器,还用于在第一移位子电路根据字节偏移量和第一输入数据获得第二输入数据后,将偏移寄存器中的字节偏移量累加所述数据长度,得到新的字节偏移量,并将得到的字节偏移量更新到所述偏移寄存器。
  40. 根据权利要求30所述的处理电路,其特征在于,
    若所有存储队列均存储有子数据,则确定满足数据输出条件;
    在输出存储队列中存储的子数据时,从所有存储队列的每个存储队列中读取子数据,并输出读取的子数据。
  41. 一种处理电路,其特征在于,所述处理电路包括:
    非对称存储队列,用于接收第三输入数据,所述第三输入数据包括图像像素值和内填充像素值;通过所述非对称存储队列包括的多个子存储队列存储所述第三输入数据中的像素值;
    输出选择子电路,用于在满足数据输出条件时,读取子存储队列中存储的像素值,并输出子存储队列中存储的像素值。
  42. 根据权利要求41所述的处理电路,其特征在于,
    所述第三输入数据包括R个图像像素值,每个图像像素值后面包括S个内填充像素值;所述非对称存储队列包括S+1个子存储队列。
  43. 根据权利要求42所述的处理电路,其特征在于,所述非对称存储队列通过多个子存储队列存储所述第三输入数据中的像素值时具体用于:
    通过每个子存储队列存储所述第三输入数据中的R个像素值。
  44. 根据权利要求43所述的处理电路,其特征在于,
    不同的子存储队列用于存储所述第三输入数据中的不同位置的像素值。
  45. 根据权利要求41所述的处理电路,其特征在于,
    所述输出选择子电路,还用于当检测到所有子存储队列均存储有像素值时,则确定满足数据输出条件;
    所述输出选择子电路读取子存储队列中存储的像素值,并输出子存储队列中存储的像素值时具体用于:从所有子存储队列的每个子存储队列中读取像素值,并输出读取的像素值。
  46. 根据权利要求45所述的处理电路,其特征在于,
    所述输出选择子电路从所有子存储队列的每个子存储队列中读取像素值,并输出读取的像素值时具体用于:
    按照子存储队列的顺序,依次遍历所有子存储队列的每个子存储队列,并从当前遍历的子存储队列中读取R个像素值,并输出读取的R个像素值。
PCT/CN2018/089404 2018-05-31 2018-05-31 数据处理方法和处理电路 WO2019227447A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2018/089404 WO2019227447A1 (zh) 2018-05-31 2018-05-31 数据处理方法和处理电路
CN201880011485.0A CN110313015A (zh) 2018-05-31 2018-05-31 数据处理方法和处理电路
US17/105,401 US20210082082A1 (en) 2018-05-31 2020-11-25 Data processing method and processing circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/089404 WO2019227447A1 (zh) 2018-05-31 2018-05-31 数据处理方法和处理电路

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/105,401 Continuation US20210082082A1 (en) 2018-05-31 2020-11-25 Data processing method and processing circuit

Publications (1)

Publication Number Publication Date
WO2019227447A1 true WO2019227447A1 (zh) 2019-12-05

Family

ID=68074286

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/089404 WO2019227447A1 (zh) 2018-05-31 2018-05-31 数据处理方法和处理电路

Country Status (3)

Country Link
US (1) US20210082082A1 (zh)
CN (1) CN110313015A (zh)
WO (1) WO2019227447A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102653177B1 (ko) * 2018-10-29 2024-04-01 삼성에스디에스 주식회사 객체 정보 추출 장치 및 방법

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060280269A1 (en) * 2005-06-08 2006-12-14 Terawins, Inc. Method for designing video and image scaler based on 2-D finite impulse response filter
CN101179721A (zh) * 2006-11-08 2008-05-14 三星电子株式会社 支持多编解码器的运动补偿的方法和设备
CN104323789A (zh) * 2014-09-25 2015-02-04 沈阳东软医疗系统有限公司 一种ct扫描图像重建方法及ct扫描仪
CN107145939A (zh) * 2017-06-21 2017-09-08 北京图森未来科技有限公司 一种神经网络优化方法及装置
CN107657257A (zh) * 2017-08-14 2018-02-02 中国矿业大学 一种基于多通道卷积神经网络的语义图像分割方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101399978B (zh) * 2007-09-28 2012-05-30 昆山杰得微电子有限公司 硬件解码器中参考帧数据的读取方法及其装置
CN102103740B (zh) * 2010-12-20 2013-01-02 福州瑞芯微电子有限公司 一种写入地址和宽度不对齐图像的处理方法和处理电路
CN103093464B (zh) * 2013-01-16 2016-06-08 四川九洲电器集团有限责任公司 基于图像的轮廓波信息隐藏方法
US11099918B2 (en) * 2015-05-11 2021-08-24 Xilinx, Inc. Accelerating algorithms and applications on FPGAs
CN105872418A (zh) * 2016-03-30 2016-08-17 浙江大华技术股份有限公司 一种在数字图像上叠加gui图层的方法及装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060280269A1 (en) * 2005-06-08 2006-12-14 Terawins, Inc. Method for designing video and image scaler based on 2-D finite impulse response filter
CN101179721A (zh) * 2006-11-08 2008-05-14 三星电子株式会社 支持多编解码器的运动补偿的方法和设备
CN104323789A (zh) * 2014-09-25 2015-02-04 沈阳东软医疗系统有限公司 一种ct扫描图像重建方法及ct扫描仪
CN107145939A (zh) * 2017-06-21 2017-09-08 北京图森未来科技有限公司 一种神经网络优化方法及装置
CN107657257A (zh) * 2017-08-14 2018-02-02 中国矿业大学 一种基于多通道卷积神经网络的语义图像分割方法

Also Published As

Publication number Publication date
CN110313015A (zh) 2019-10-08
US20210082082A1 (en) 2021-03-18

Similar Documents

Publication Publication Date Title
EP3561674A1 (en) Block data check method and apparatus
CN102096609B (zh) 可编程循环冗余校验(crc)计算的指令集架构
CN108733344A (zh) 数据读写方法、装置以及环形队列
CN102968390B (zh) 基于预先解码分析的配置信息缓存管理方法及系统
KR20190027716A (ko) 하드웨어 친화적인 가상 프레임 버퍼
JP2010027032A (ja) Fifo装置及びfifoバッファへのデータ格納方法
US9684737B2 (en) Accessing an N-way linked list
US20100211747A1 (en) Processor with reconfigurable architecture
JP7074839B2 (ja) パケット処理
CN103413569B (zh) 一读且一写静态随机存储器
CN112380148A (zh) 数据传输方法和数据传输装置
US11714651B2 (en) Method and tensor traversal engine for strided memory access during execution of neural networks
CN116010299B (zh) 一种数据处理方法、装置、设备及可读存储介质
JPS60146346A (ja) ハツシング装置
US9501395B2 (en) Re-aligning a compressed data array
WO2019227447A1 (zh) 数据处理方法和处理电路
WO2021237510A1 (zh) 数据解压缩的方法、系统、处理器及计算机存储介质
US9395982B1 (en) Atomic memory operations on an N-way linked list
CN110968538B (zh) 一种数据缓冲方法和装置
CN110554886B (zh) 数据拆分结构、方法及其片上实现
CN110888622A (zh) 实现任意深度异步fifo的方法及装置、设备、介质
JP4391464B2 (ja) 2分木構造の情報を記憶する装置及びヒープ構造の情報を記憶する装置
JP5499131B2 (ja) デュアルポートメモリおよびその方法
CN115905038B (zh) 缓存数据读取方法、装置、计算机设备和存储介质
US20190155610A1 (en) Data generation device for parallel processing

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18921125

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18921125

Country of ref document: EP

Kind code of ref document: A1