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

Method for converting NV12+ format into P010 format Download PDF

Info

Publication number
CN110798689A
CN110798689A CN201910995370.6A CN201910995370A CN110798689A CN 110798689 A CN110798689 A CN 110798689A CN 201910995370 A CN201910995370 A CN 201910995370A CN 110798689 A CN110798689 A CN 110798689A
Authority
CN
China
Prior art keywords
data
format
register
bits
additional
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.)
Granted
Application number
CN201910995370.6A
Other languages
Chinese (zh)
Other versions
CN110798689B (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)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Color Television Systems (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 in the 16 bits high by 10 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 for storing YUV components and 2-bit data for storing an additional, where 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 of the 2-bit data for reading are put on the highest bit of one byte by using the PDEP command and denoted as C, 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 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 BDA0002239551140000051
Figure BDA0002239551140000061
Figure BDA0002239551140000071
Figure BDA0002239551140000081
the implementation process is as follows:
d, operation process: (16 bytes)
D0:0x0000000000000000 0x0000000000000000 0x81828384717273740x6162636451525354
D1:0x0000000000000000 0x8182838471727374 0x00000000000000000x6162636451525354
D2:0x0081008200830084 0x0071007200730074 0x00610062006300640x0051005200530054
D3:0x8100820083008400 0x7100720073007400 0x61006200630064000x5100520053005400
d, operation process: (4 bytes)
0xaaaa 0xffff
C0:0x8080808080808080 0xc0c0c0c0c0c0c0c0
C1:0x0000000000000000 0x0000000000000000 0xc0c0c0c0c0c0c0c00x8080808080808080
C2:0x00000000000000000xc0c0c0c0c0c0c0c0 0x00000000000000000x8080808080808080
C3:0x00c000c000c000c0 0x00c000c000c000c0 0x00800080008000800x0080008000800080
D + D results:
D3+C3:0x81c082c083c084c0 0x71c072c073c074c0 0x61806280638064800x5180528053805480
p010be data were obtained:
0x81c082c083c084c0 0x71c072c073c074c0 0x61806280638064800x5180528053805480
p010le data were obtained:
0x0207020b020f0213 0x01c701cb01cf01d3 0x0186018a018e01920x0146014a014e0152 。

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 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.
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 true CN110798689A (en) 2020-02-14
CN110798689B 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)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050244149A1 (en) * 2004-04-30 2005-11-03 Nec Electronics Corporation Format conversion method and apparatus and format conversion control program
CN101217673A (en) * 2007-01-02 2008-07-09 三星电子株式会社 Format conversion apparatus from band interleave format to band separate format
US7649539B2 (en) * 2004-03-10 2010-01-19 Microsoft Corporation Image formats for video capture, processing and display
CN106233706A (en) * 2014-02-25 2016-12-14 苹果公司 For providing the apparatus and method of the back compatible of the video with standard dynamic range and HDR
CN107251557A (en) * 2015-01-16 2017-10-13 微软技术许可有限责任公司 The coding/decoding of chrominance resolution details
CN110351562A (en) * 2019-06-25 2019-10-18 西安交通大学 A kind of 10 bit YUV image storage formats

Patent Citations (7)

* 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
US20050244149A1 (en) * 2004-04-30 2005-11-03 Nec Electronics Corporation Format conversion method and apparatus and format conversion control program
CN101217673A (en) * 2007-01-02 2008-07-09 三星电子株式会社 Format conversion apparatus from band interleave format to band separate format
CN101217673B (en) * 2007-01-02 2010-08-18 三星电子株式会社 Format conversion apparatus from band interleave format to band separate format
CN106233706A (en) * 2014-02-25 2016-12-14 苹果公司 For providing the apparatus and method of the back compatible of the video with standard dynamic range and HDR
CN107251557A (en) * 2015-01-16 2017-10-13 微软技术许可有限责任公司 The coding/decoding of chrominance resolution details
CN110351562A (en) * 2019-06-25 2019-10-18 西安交通大学 A kind of 10 bit YUV image storage formats

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MCIROSOFT DOCS: "《https://software.intel.com/en-us/forums/media/topic/628067》", 31 May 2018 *
NEVCAIRIEL: "《https://github.com/Nevcairiel/LAVFilters/blob/e521e0cb195bf42dccb04dd354ea5ff0186b6ae1/decoder/LAVVideo/pixconv/convert_direct.cpp》", 2 February 2015 *

Also Published As

Publication number Publication date
CN110798689B (en) 2021-01-19

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
JPS60146326A (en) Image conversion from bit map to run display
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
US9712848B2 (en) Frame buffer compression using separate aggregation of fixed-length and variable-length components of codewords
CN112422985B (en) Multi-core parallel hardware coding method and device suitable for JPEG
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
US7460718B2 (en) Conversion device for performing a raster scan conversion between a JPEG decoder and an image memory
US10306200B2 (en) Efficient 10-bit pixel formatting of uncompressed 4K video signals for distributed processing
US7340101B2 (en) Device and method for compressing and decompressing data for graphics display
US8363968B2 (en) Image coding method for facilitating run length coding and image encoding device thereof
US10283094B1 (en) Run-length compression and decompression of media tiles
US20080154999A1 (en) Compressed Floating Point Representation Of Points On Monotonic Curves Which Can Be Specified By High Order Equations
US11954028B2 (en) Accessing encoded blocks of data
CN112699639B (en) Storage method and device of integer data and storage medium
CN113038269B (en) Image data processing system and method
US11386021B2 (en) Apparatus and method for packing a bit stream
CN116170599A (en) Synchronous real-time image compression method, system, medium and terminal
US20140300628A1 (en) Tile-based compression and decompression for graphic applications
WO2019191904A1 (en) Data processing method and device
CN110875744A (en) Encoding 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