[go: up one dir, main page]

CN110798689B - A method to convert NV12+ format to P010 format - Google Patents

A method to convert NV12+ format to 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

本发明公开了一种将NV12+格式转换为P010格式的方法,包括以下步骤;1)使用VMOVDQA命令,将YUV分量的8比特数据及附加的2比特数据分别移动到两个寄存器中;2)使用VPERMQ指令移动对齐的打包整数值,将存储在寄存器连续地址上的数据平均搬移至AVX寄存器的高低位地址上;3)使用VPUNPCKLBW指令将寄存器中的数据与0交织组合,即将寄存器中的数据与全0交叉组合间隔相放后置于寄存器中,在交叉组合之后,将NV12格式的数据D按字左移8位,其中,附加的2比特数据的数据C位置保持不变;4)通过VPADDW指令依次完成存放NV12的D数据的寄存器值与存放额外2比特的C数据的寄存器值的相加,完成NV12+格式至P010be格式的转换,该方法能够快速的将NV12+格式转换为P010格式。

Figure 201910995370

The invention discloses a method for converting NV12+ format to P010 format, comprising the following steps: 1) using the VMOVDQA command to move the 8-bit data of the YUV component and the additional 2-bit data into two registers respectively; 2) using the VMOVDQA command The VPERMQ instruction moves the aligned packed integer value, and moves the data stored in the continuous address of the register to the high and low addresses of the AVX register on average; 3) Use the VPUNPCKLBW instruction to interleave the data in the register with 0, that is, the data in the register is combined with All 0s are interleaved and placed in the register. After the interleave, the data D in the NV12 format is shifted left by 8 bits by word, and the position of the data C of the additional 2-bit data remains unchanged; 4) Through VPADDW The instruction completes the addition of the register value of the D data of NV12 and the register value of the C data of the extra 2 bits in turn, and completes the conversion from NV12+ format to P010be format. This method can quickly convert NV12+ format to P010 format.

Figure 201910995370

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 A method to convert NV12+ format to 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 A method to convert NV12+ format to P010 format

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910995370.6A CN110798689B (en) 2019-10-18 2019-10-18 A method to convert NV12+ format to 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 A method to convert NV12+ format to P010 format

Country Status (1)

Country Link
CN (1) CN110798689B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119172511B (en) * 2024-11-15 2025-02-25 湖北芯擎科技有限公司 YUV data storage method, device, equipment and storage medium

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 device from band interleave format to band division format
JP6383425B2 (en) * 2014-02-25 2018-08-29 アップル インコーポレイテッドApple Inc. Adaptive transfer functions 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
CN101340587A (en) Method for encoding input image and method and device for playing encoded image
US11308647B2 (en) Method and system for improving compression ratio by difference between blocks of image file
EP2787738A1 (en) Tile-based compression and decompression for graphic applications
CN101790094B (en) A VLSI System Structure and Implementation Method of JPEG Image Decoder
CN102868871B (en) Method and device for converting video image format
JPS60146326A (en) Image conversion from bit map to run display
TW202121340A (en) Data compression system and data mapping method
US11539955B2 (en) Method and system for improving compression ratio through pixel conversion of image file
CN110798689B (en) A method to convert NV12+ format to P010 format
CN110351562A (en) A kind of 10 bit YUV image storage formats
CN103262123B (en) Segment coding and decoding
US11954028B2 (en) Accessing encoded blocks of data
CN110769211A (en) Image raster data transmission and storage method
CN100442670C (en) Variable length decoding device, variable length decoding method, and reproduction system
JP2004509528A (en) Data transfer between RGB color space and YCrCb color space for DCT interface
WO2018068250A1 (en) Method and device for data processing, chip and camera
SE0900522A1 (en) Image encoder and method for encoding images
WO2019191904A1 (en) Data processing method and device
US20110317933A1 (en) Image Coding Method for Facilitating Run Length Coding and Image Encoding Device Thereof
JPH09247466A (en) Encoding device
US20180367779A1 (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
CN1299561A (en) Method for encoding image information and method for decoding
US20140300628A1 (en) Tile-based compression and decompression for graphic applications
US20060170708A1 (en) Circuits for processing encoded image data using reduced external memory access and methods of operating the same

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