CN110798689B - Method for converting NV12+ format into P010 format - Google Patents

Method for converting NV12+ format into P010 format Download PDF

Info

Publication number
CN110798689B
CN110798689B CN201910995370.6A CN201910995370A CN110798689B CN 110798689 B CN110798689 B CN 110798689B CN 201910995370 A CN201910995370 A CN 201910995370A CN 110798689 B CN110798689 B CN 110798689B
Authority
CN
China
Prior art keywords
data
format
register
storing
bits
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910995370.6A
Other languages
Chinese (zh)
Other versions
CN110798689A (en
Inventor
符均
刘耀远
吴长丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Jiaotong University
Original Assignee
Xian Jiaotong University
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 Xian Jiaotong University filed Critical Xian Jiaotong University
Priority to CN201910995370.6A priority Critical patent/CN110798689B/en
Publication of CN110798689A publication Critical patent/CN110798689A/en
Application granted granted Critical
Publication of CN110798689B publication Critical patent/CN110798689B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Color Television Systems (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a method for converting NV12+ format into P010 format, which comprises the following steps; 1) using VMOVDQA command to move 8-bit data of YUV components and additional 2-bit data into two registers respectively; 2) moving the aligned packed integer value by using a VPERMQ instruction, and averagely moving the data stored on the continuous address of the register to the high-order address and the low-order address of the AVX register; 3) using VPUNPCKLBW instruction to interleave and combine the data in the register with 0, namely, placing the data in the register after being placed with all 0 interleave combination interval, and after interleaving combination, shifting data D in NV12 format by 8 bits to the left according to words, wherein the position of data C of the additional 2-bit data is kept unchanged; 4) the addition of the register value of D data storing NV12 and the register value of C data storing 2 extra bits is sequentially completed through a VPADDW instruction, the conversion from the NV12+ format to the P010be format is completed, and the method can rapidly convert the NV12+ format into the P010 format.

Description

Method for converting NV12+ format into P010 format
Technical Field
The invention belongs to the field of image coding, and relates to a method for converting NV12+ format into P010 format.
Background
Many hardware encoders (e.g., QSV, NVENC) natively support NV12 format image input, and the P010 storage format is a 10-bit video image encoding format, whose YUV takes 4: 2: and 0 sampling, wherein all Y are stored in the storage sequence, then UV is stored alternately, and YUV is 10 bits. The P010 is stored by 16 bits (2 bytes), and is divided into P010le and P010be according to different size ends, and 10 bits are placed at the lower 10 bits of the 16 bits by the P010 le; p010be places 10 bits higher than 16 bits. The storage format is shown in fig. 1:
p010 stores 10-bit pictures with 25% more information than the 8-bit pictures stored by NV12, but 100% more storage space. This may have a detrimental effect on the image acquisition. Therefore, a new way of encoding pictures, called NV12+, has emerged. NV12+ splits 10 bits into high 8 bits plus low 2 bits, the high 8 bits being one byte, the 4 low 2 bits being spliced into one byte, the pixel data splitting mode is shown in fig. 2. And storing the split and spliced bytes according to the sequence of FIG. 3, namely, the storage format of NV12+ image.
NV12+ is made up of NV12 plus extra data, for 8-bit video coding, NV12 data can be used directly; for 10-bit video coding, if the NV12+ format can be quickly converted into the P010 format, the NV12+ only stores 10-bit image effective information and has no data redundancy, the data transmission efficiency of the acquisition card can be effectively improved, the storage space is reduced, and the data transmission efficiency of the acquisition card is improved, however, a similar format conversion method does not exist in the prior art.
Disclosure of Invention
The present invention is directed to overcoming the above-mentioned disadvantages of the prior art and providing a method for converting NV12+ format into P010 format, which can rapidly convert NV12+ format into P010 format.
To achieve the above object, the method for converting NV12+ format to P010 format according to the present invention comprises the following steps:
1) known from the image storage format of NV12+, the data is composed of 8-bit data for storing YUV components and 2-bit data for storing an additional, each byte of the 8-bit data for the YUV components is denoted as D, the 2-bit data for the additional is denoted as D, each 2 bits in the read 2-bit data for the additional are put to the highest bit of one byte and denoted as C by using a PDEP command, and then the 8-bit data for the YUV components and the 2-bit data for the additional are respectively moved to two registers by using a vmovova command;
2) moving the aligned packed integer value by using a VPERMQ instruction, and averagely moving the data stored on the continuous address of the register to the high-order address and the low-order address of the AVX register;
3) using VPUNPCKLBW instruction to interleave and combine the data in the register with 0, namely, placing the data in the register after being placed with all 0 interleave combination interval, and after interleaving combination, shifting data D in NV12 format by 8 bits to the left according to words, wherein the position of data C of the additional 2-bit data is kept unchanged;
4) the addition of the register value storing D data of NV12 and the register value storing C data of an additional 2 bits is sequentially completed by the VPADDW instruction, and the conversion of the NV12+ format to the P010be format is completed.
When the NV12+ format needs to be converted into data in the P010le format, the method further includes, after the step 4): the data in the format of P010be is shifted right by 6 bits by using VPSRLVQ instruction to obtain the data in the format of P010 le.
The invention has the following beneficial effects:
in the whole format conversion process, the method for converting the NV12+ format into the P010 format utilizes the AVX2 instruction set to enable all data operations to be parallel operation, and the register value for storing D data in the NV12+ format and the register value for storing C data in 2 bits are respectively and simultaneously operated, so that the time is further shortened.
Drawings
FIG. 1 is a schematic diagram of a P010 memory format;
FIG. 2 is a schematic diagram of a 10-bit splitting and splicing method;
FIG. 3 is a diagram of an NV12+ image storage format;
FIG. 4 is a diagram illustrating the present invention after data is placed in registers and aligned;
FIG. 5 is a diagram illustrating an average shift of data to the high and low addresses of the AVX register according to the present invention;
FIG. 6 is a schematic diagram of the present invention after data and full 0 cross-combine intervals are placed;
FIG. 7 is a diagram illustrating the addition of data between registers according to the present invention;
FIG. 8 is a diagram illustrating the NV12+ format converted to the P010 format according to the present invention.
Detailed Description
The invention is described in further detail below with reference to the accompanying drawings:
the specific operation process of the method for converting the NV12+ format into the P010 format comprises the following steps:
the YUV components in NV12 format are 8 bits, the YUV components in P010 format are 10 bits, and when the acquisition card acquires data in P010 format, it is desirable that the acquisition card acquires 8 bits of data in NV12 format and adds 2 bits of NV12+ format data to reduce the traffic of PCIE. After the acquisition is finished, the AVX2 instruction is used for quickly converting the NV12+ format data into the P010 format, the invention aims to finish the quick conversion between the formats, and the specific conversion process is as follows:
according to the image storage format of NV12+, the data is composed of 8-bit data storing YUV components and 2-bit data storing an additional, where each byte of the 8-bit data of the YUV components is denoted as D, the 2-bit data storing an additional is denoted as D, each 2 bits of the 2-bit data read by the PDEP command are placed on the highest bit of one byte and denoted as C, and then the 8-bit data D storing the YUV components and the data C storing an additional 2-bit data are respectively moved to two registers by using the VMOVDQA command, taking the Y component of 16 8+ 2-bit pixels as an example, as shown in fig. 4:
using VPERMQ instruction to move aligned packed integer values, the data stored in the consecutive addresses of the register is averagely moved to the high and low addresses of the AVX register, taking the Y component of 16 8+2 bit pixels as an example, as shown in fig. 5:
after the shift is completed, the data in the register is interleaved and combined with 0 using the vpunapcklbw instruction, that is, the data is placed in the register after being placed at the interval of all 0 cross combination, and after the cross combination, the data D in the NV12 format is left-shifted by 8 bits by word, wherein the data C position of the additional 2-bit data remains unchanged, taking the Y component of 16 8+ 2-bit pixels as an example, as shown in fig. 6:
finally, the addition of the register value storing D data of NV12 and the register value storing C data of 2 extra bits is sequentially completed by the VPADDW instruction, so that the format conversion speed is further improved, and the conversion between NV12+ format and P010be format is completed, taking the Y component of 16 8+ 2-bit pixels as an example, as shown in fig. 7:
in the whole process, the data of the Y component is processed first, and then the data of the UV component is processed, so that the process is continuously circulated until all the input data of NV12 are converted into data of the P010be format, taking the data of 16 8+ 2-bit pixels as an example, the format conversion result is as shown in fig. 8:
when the NV12+ format needs to be converted into the data in the P010le format, after the NV12+ format is converted into the P010be format, the data in the P010be format are all shifted to the right by 6 bits by using the VPSRLVQ instruction, and the data in the P010le format is obtained.
Example one
In this embodiment, 8+ 2-bit pixels are taken as an example to show a specific procedure and an execution result.
Let NV12 data read be 28 bytes of 0x8182838471727374 and 0x6162636451525354, and the additional 2 bits of data read be 2 bytes of 0xaaaa and 0 xffff. The method for rapid format conversion by AVX2 comprises the following steps: converting the data into 4P 010 format data with 8 bytes, wherein the format conversion program is as follows:
Figure GDA0002730491920000051
Figure GDA0002730491920000061
Figure GDA0002730491920000071
Figure GDA0002730491920000081
Figure GDA0002730491920000091
the implementation process is as follows:
d, operation process: (16 bytes)
D0:0x0000000000000000 0x0000000000000000 0x8182838471727374 0x6162636451525354
D1:0x0000000000000000 0x8182838471727374 0x0000000000000000 0x6162636451525354
D2:0x0081008200830084 0x0071007200730074 0x0061006200630064 0x0051005200530054
D3:0x8100820083008400 0x7100720073007400 0x6100620063006400 0x5100520053005400
d, operation process: (4 bytes)
0xaaaa 0xffff
C0:0x8080808080808080 0xc0c0c0c0c0c0c0c0
C1:0x0000000000000000 0x0000000000000000 0xc0c0c0c0c0c0c0c0 0x8080808080808080
C2:0x0000000000000000 0xc0c0c0c0c0c0c0c0 0x0000000000000000 0x8080808080808080
C3:0x00c000c000c000c0 0x00c000c000c000c0 0x0080008000800080 0x0080008000800080
D + D results:
D3+C3:0x81c082c083c084c0 0x71c072c073c074c0 0x6180628063806480 0x5180528053805480
p010be data were obtained:
0x81c082c083c084c0 0x71c072c073c074c0 0x6180628063806480 0x5180528053805480
p010le data were obtained:
0x0207020b020f0213 0x01c701cb01cf01d3 0x0186018a018e0192 0x0146014a014e0152

Claims (2)

1. a method of converting NV12+ format to P010 format, comprising the steps of:
1) known from the image storage format of NV12+, the data is composed of 8-bit data for storing YUV components and 2-bit data for storing an additional, each byte of the 8-bit data for the YUV components is denoted as D, the 2-bit data for storing an additional is denoted as D, every 2 bits in the read 2-bit data for storing an additional are put to the highest bit of one byte and denoted as C by using a PDEP command, and then the 8-bit data D for storing YUV components and the data C for storing 2-bit data for storing an additional are respectively moved to two registers by using a vmovova command;
2) moving the aligned packed integer value by using a VPERMQ instruction, and averagely moving the data stored on the continuous address of the register to the high-order address and the low-order address of the AVX register;
3) using VPUNPCKLBW instruction to interleave and combine the data in the register with 0, namely, placing the data in the register after being placed with all 0 interleave combination interval, and after interleaving combination, shifting data D in NV12 format by 8 bits to the left according to words, wherein the position of data C of the additional 2-bit data is kept unchanged;
4) the addition of the register value storing D data of NV12 and the register value storing C data of an additional 2 bits is sequentially completed by the VPADDW instruction, and the conversion of the NV12+ format to the P010be format is completed.
2. The method of claim 1, wherein when NV12+ format is required to be converted into P010 format, the method further comprises, after the step 4): the data in the format of P010be is shifted right by 6 bits by using VPSRLVQ instruction to obtain the data in the format of P010 le.
CN201910995370.6A 2019-10-18 2019-10-18 Method for converting NV12+ format into P010 format Active CN110798689B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910995370.6A CN110798689B (en) 2019-10-18 2019-10-18 Method for converting NV12+ format into P010 format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910995370.6A CN110798689B (en) 2019-10-18 2019-10-18 Method for converting NV12+ format into P010 format

Publications (2)

Publication Number Publication Date
CN110798689A CN110798689A (en) 2020-02-14
CN110798689B true CN110798689B (en) 2021-01-19

Family

ID=69440453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910995370.6A Active CN110798689B (en) 2019-10-18 2019-10-18 Method for converting NV12+ format into P010 format

Country Status (1)

Country Link
CN (1) CN110798689B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7649539B2 (en) * 2004-03-10 2010-01-19 Microsoft Corporation Image formats for video capture, processing and display
JP4455147B2 (en) * 2004-04-30 2010-04-21 Necエレクトロニクス株式会社 Format conversion method, apparatus and program
KR100879896B1 (en) * 2007-01-02 2009-01-21 삼성전자주식회사 Format Conversion Apparatus from Band Interleave Format to Band Separate Format
CN116320394A (en) * 2014-02-25 2023-06-23 苹果公司 Adaptive transfer function for video encoding and decoding
US9749646B2 (en) * 2015-01-16 2017-08-29 Microsoft Technology Licensing, Llc Encoding/decoding of high chroma resolution details
CN110351562A (en) * 2019-06-25 2019-10-18 西安交通大学 A kind of 10 bit YUV image storage formats

Also Published As

Publication number Publication date
CN110798689A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
JP2009273035A (en) Image compression apparatus, image decompression apparatus, and image processor
CN101340587A (en) Method for encoding input image, method and apparatus for displaying an encoded image
CN102868871B (en) Method and device for converting video image format
EP2787738B1 (en) Tile-based compression for graphic applications
CN110798689B (en) Method for converting NV12+ format into P010 format
CN112118449A (en) Method and device for compressing and decompressing image
CN112422985B (en) Multi-core parallel hardware coding method and device suitable for JPEG
US20160134878A1 (en) Frame buffer compression using separate aggregation of fixed-length and variable-length components of codewords
CN100345436C (en) Image processing apparatus
JP5894605B2 (en) Method and apparatus
CN110351562A (en) A kind of 10 bit YUV image storage formats
US8732363B2 (en) Data processing apparatus and data processing method
WO2021143634A1 (en) Arithmetic coder, method for implementing arithmetic coding, and image coding method
US10306200B2 (en) Efficient 10-bit pixel formatting of uncompressed 4K video signals for distributed processing
US7460718B2 (en) Conversion device for performing a raster scan conversion between a JPEG decoder and an image memory
US20110142333A1 (en) Image processing apparatus and computer readable medium
US7340101B2 (en) Device and method for compressing and decompressing data for graphics display
US10283094B1 (en) Run-length compression and decompression of media tiles
US20110317933A1 (en) Image Coding Method for Facilitating Run Length Coding and Image Encoding Device Thereof
US20080154999A1 (en) Compressed Floating Point Representation Of Points On Monotonic Curves Which Can Be Specified By High Order Equations
US11303911B1 (en) Systems and methods for storing video data in memory
US11954028B2 (en) Accessing encoded blocks of data
CN113038269B (en) Image data processing system and method
CN104113344A (en) Decompression circuit, correlated compression method, and correlated decompression method
WO2019191904A1 (en) Data processing method and device

Legal Events

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