High-resolution test signal generation method based on python adaptive color space conversion

Through Python adaptive color space conversion and FFmpeg packaging technology, the problem that the fixed color space conversion standard is not compatible with multi-spec equipment is solved, and the efficient generation of multi-spec test signals is achieved, which improves testing efficiency and accuracy.

CN120281896APending Publication Date: 2025-07-08NANJING UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510460322.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

In the prior art, fixed color space conversion standards are not compatible with ultra-high-definition and full-high-definition devices, resulting in low efficiency in generating test signals and unable to meet the detection needs of multi-special devices.

Method used

Python adaptive color space conversion method is adopted to automatically correlate color space standards by receiving resolution parameters, generate high-resolution test signals, and use the FFmpeg framework to package it into MP4 video streams to achieve compatibility of multi-special devices.

Benefits of technology

It realizes the generation of test signals of multi-spec equipment on one platform, improves testing efficiency, reduces manual intervention, and ensures signal accuracy and standardization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120281896A_ABST
    Figure CN120281896A_ABST
Patent Text Reader

Abstract

The invention provides a high-resolution test signal generation method based on python adaptive color space conversion. The method comprises the following steps: automatically matching BT.2020 / BT.709 color spaces according to an input resolution through a dynamic color gamut standard selection module; a high-low bit interchange algorithm is adopted to realize small-end-to-large-end conversion of 10-bit YCbCr data in order to ensure that the byte sequence of the data meets the requirement of a large-end format; designing a 17-level precise gray scale and composite color bar generation algorithm, and completing RGB-YCbCr high-precision conversion through a configurable conversion matrix; and FFmpeg video coding is integrated, so that integrated output of a YUV422p10be video pixel packaging format is realized. According to the invention, the problem of poor color gamut adaptability of a traditional test signal is solved, and the test precision and efficiency of the ultra-high-definition display equipment can be remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of digital image processing technology, and particularly to a high-resolution test signal generation method based on python adaptive color space conversion. Background Art

[0002] With the development of display technology, the brightness and color performance of display devices have become important indicators for measuring display effects. To ensure the quality and consistency of display devices, strict tests are required. In the electronic display industry, products such as liquid crystal displays (LCDs) and organic light-emitting diode displays (OLEDs) need to undergo multiple performance tests during the manufacturing and quality control processes, such as brightness uniformity tests; color accuracy tests; resolution tests. To carry out these tests, corresponding specific test patterns are usually required to assist in completing the detection process.

[0003] Currently, there are mainly the following ways to obtain these test patterns: One is to rely on professional graphics generation software. Such software often has complex functions and cumbersome operations, requires professional personnel to spend a lot of time learning and mastering, and has high software licensing fees; the other is to manually draw some simple patterns. This method has extremely low efficiency and is difficult to ensure the accuracy and standardization of the patterns, and cannot meet the fast and accurate requirements in large-scale production detection.

[0004] The technical bottleneck of the current test signal generation method is the limitation of gamut adaptation: the fixed color space conversion standard leads to the inability to be compatible with ultra-high definition (BT.2020) and full high definition (BT.709) devices. Summary of the Invention

[0005] This application provides a high-resolution test signal generation method based on python adaptive color space conversion, which can be used to solve the technical problem that the fixed color space conversion standard leads to the inability to be compatible with ultra-high definition and full high definition devices.

[0006] This application provides a high-resolution test signal generation method based on python adaptive color space conversion, and the method includes:

[0007] Step 1, receive the resolution parameter and automatically associate the color space standard, and load the 10-bit RGB data of the test signal from the data set.

[0008] Step 11, define the data set:

[0009] For the grayscale signal, based on the resolution, generate 17 levels of linear grayscale, where the RGB components of the grayscale are equal, and the value range is 64 - 940.

[0010] The 17-level grayscale includes the initial 64 and the final 940 values, and the adjacent level difference is calculated as

[0011] The 17 - step values start from 64, with a step of 57.25. The actual values are integers, rounded according to the rounding - off rule, and end at 940.

[0012] For the composite color bar signal, the composite color bar signal supports two saturation modes of 100% and 75%, and includes eight reference colors: white, yellow, cyan, green, magenta, red, blue, and black. The RGB values of each reference color comply with the ITU - T T.871 standard.

[0013] Step 12, Resolution detection and color gamut matching:

[0014] If the input resolution is 3840×2160 or 7680×4320, load the BT.2020 conversion function.

[0015] If it is 1920×1080, load the BT.709 conversion function.

[0016] Step 2, Color space conversion to achieve the conversion from RGB to YCbCr;

[0017] Call the color space conversion function in Python to achieve the conversion from RGB to YCbCr. The input and output ranges are 10 - bit legal values, that is, 64 - 940, to avoid out - of - range clipping. The BT.709 conversion function is as follows:

[0018] Y = 0.2126R + 0.7152G + 0.0722B

[0019]

[0020] The BT.2020 color gamut conversion function is as follows:

[0021] Y = 0.2627R + 0.6780G + 0.0593B

[0022]

[0023] Among them, Y is the luminance component; Cb is the blue chrominance component; Cr is the red chrominance component; R is the red component, G is the green component, and B is the blue component.

[0024] Step 3, Data recombination and big - endian format generation: Perform the high - low byte swapping algorithm on the 10 - bit YCbCr data to ensure that the byte order of the data meets the requirements of the big - endian format. The method is as follows:

[0025] Step 31, Divide the 10 - bit YCbCr data by 256 to get the high - order byte;

[0026] Step 32, Obtain the low - order byte by subtracting the product of the high - order byte multiplied by 256 from the input value.

[0027] Step 33: Shift the lower byte left by 8 bits and perform a bitwise OR operation with the higher byte to obtain the output value.

[0028] Step 4: Test the pattern to generate a binary file;

[0029] Sort and store the 10-bit YCbCr image data in the big-endian format as a binary file in the YUV422p10be format. This format is designed specifically for ultra-high-definition test signals. Through chroma subsampling, compatibility with mainstream video encoders can be ensured.

[0030] The byte sorting method for the YUV422p10be format is as follows: for the planar format of chroma subsampling, the Y component of each pixel is stored independently, and the Y components of every two pixels share the same set of Cb and Cr components horizontally; they are arranged in the order of the Y component with full resolution, the Cb component with half of the full resolution, and the Cr component with half of the full resolution.

[0031] Step 5: Video encapsulation output: Based on the generated binary file in the YUV422p10be format, encapsulate it as an MP4 video stream through dynamic parameter matching with the FFmpeg framework to achieve adaptive output of multiple resolutions and color gamut standards.

[0032] Step 51: Dynamically match the target specifications according to the input resolution parameters. For ultra-high definition (3840×2160), associate with the BT.2020 transfer function; for full high definition (1920×1080), associate with the BT.709 transfer function;

[0033] Step 52: Call the test signal generation function to generate a binary file in the YUV422p10be format and store it in the specified path;

[0034] Step 53: Through the FFmpeg command-line tool, inject the resolution, pixel format, and encoder parameters to encapsulate the data as an MP4 format video stream.

[0035] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0036] Automatically match the color space standard and encoding parameters through the resolution parameters to achieve multi-specification output on one platform. From signal generation to video encapsulation, no manual intervention is required, significantly improving the test efficiency. Brief Description of the Drawings

[0037] Figure 1 It is a flowchart of the method provided by this application. Detailed Embodiment

[0038] According to the technical solution of the present invention, without changing the essential spirit of the present invention, those of ordinary skill in the art can envision various embodiments of the present invention. Therefore, the following specific embodiments are only illustrative descriptions of the technical solution of the present invention and should not be regarded as all of the present invention or as a limitation or restriction on the technical solution of the present invention. On the contrary, the purpose of providing these embodiments is to enable those skilled in the art to understand the present invention more thoroughly.

[0039] The present invention uses the colour-science library of Python (version ≥ 0.4.2), and its RGB_to_YCbCr function strictly follows the ITU-R standard.

[0040] Example 1: Generation of Ultra-High Definition Gray Scale Signal

[0041] 1. Input parameters: ROWS = 2160, COLS = 3840, trigger BT.2020 mode;

[0042] 2. Load 17-level gray scale RGB values (64 - 940, step size 57);

[0043] 3. Conversion calculation: Call the color space conversion function to convert 10-bit RGB to 10-bit YCbCr color space:

[0044] 4. Data reorganization: Convert 10-bit YCbCr data to big-endian format through the high-low byte swapping algorithm and write it into the byte stream. Each pixel luminance component is stored independently, and the array size is ROWS × COLS. The chrominance components share the same set of values for every two pixels in the horizontal direction, and the array size is half of ROWS × COLS. Store it as a binary file.

[0045] 5. Video encapsulation: Use FFmpeg to encapsulate the binary file into a video file with a size of 3840x2160 pixels, pixel format YUV422p10be, frame rate 60, encoder libx264, and encapsulation format MP4.

[0046] Example 2: Generation of Full-High Definition Color Bar Signal

[0047] 1. Input parameters: ROWS = 1080, COLS = 1920, trigger BT.709 mode;

[0048] 2. Load 100% saturation color bar RGB values that conform to the ITU-T T.871 standard;

[0049] 3. Conversion calculation: Call the color space conversion function to convert 10-bit RGB to 10-bit YCbCr color space;

[0050] 4. Data Reorganization: Convert 10-bit YCbCr data to big-endian format through a high-low byte swapping algorithm and write it into a byte stream. Each pixel luminance component is stored independently, with the array size of ROWS×COLS. For the chrominance components, every two pixels share the same set of values horizontally, and the array size is half of ROWS×COLS. Store it as a binary file.

[0051] 5. Video Encapsulation: Use FFmpeg to encapsulate the binary file into a video file with a pixel format of YUV422p10be, a frame rate of 60, an encoder of libx264, and an encapsulation format of MP4, with a size of 1920x1080 pixels;

[0052] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, further improvements and designs can be made, and these improvements and designs should also be regarded as the protection scope of the present invention.

[0053] The embodiments of the present application described above do not constitute a limitation on the protection scope of the present application.

Claims

1. A method for generating high-resolution test signals based on adaptive color space conversion in Python, characterized in that The method includes: Step 1: Receive the resolution parameter and automatically associate the color space standard, and load the 10-bit RGB data of the test signal from the data set; Step 2: Perform color space conversion to achieve the conversion from RGB to YCbCr; Step 3: Data reorganization and big-endian format generation: Perform the high-low byte swapping algorithm on the 10-bit YCbCr data to ensure that the byte order of the data meets the requirements of the big-endian format; Step 4: Generate a binary file for the test pattern; Step 5: Video encapsulation output: Based on the generated YUV422p10be format binary file, encapsulate it into an MP4 video stream through dynamic parameter matching and the FFmpeg framework to achieve adaptive output of multiple resolutions and color gamut standards.

2. The method according to claim 1, wherein Step 1: Receive the resolution parameter and automatically associate the color space standard, and load the 10-bit RGB data of the test signal from the data set, including: Step 11: Define the data set: For the grayscale signal, based on the resolution, generate 17 levels of linear grayscale, where the RGB components of the grayscale are equal, and the value range is 64 - 940. The 17 - level gray scale includes the initial 64 and the final 940 values, and the adjacent level difference is calculated as The 17-level values start from 64, with a step of 57.

25. The actual values are integers, rounded according to the rounding rules, and end at 940. For the composite color bar signal, the composite color bar signal supports two saturation modes of 100% and 75%, includes eight reference colors of white, yellow, cyan, green, magenta, red, blue, and black, and the RGB values of each reference color conform to the ITU-T T.871 standard; Step 12: Resolution detection and color gamut matching: If the input resolution is 3840×2160 or 7680×4320, load the BT.2020 conversion function; If it is 1920×1080, load the BT.709 conversion function.

3. The method according to claim 1, wherein Step 2: Perform color space conversion to achieve the conversion from RGB to YCbCr; including: Call the color space conversion function in Python to achieve the conversion from RGB to YCbCr, and the input and output ranges are legal 10-bit values, that is, 64 - 940, to avoid out-of-bounds clipping; the BT.709 conversion function is as follows: Y = 0.2126R + 0.7152G + 0.0722B The BT.2020 color gamut conversion function is as follows: Y = 0.2627R + 0.6780G + 0.0593B Where Y is the luminance component; Cb is the blue chrominance component; Cr is the red chrominance component; R is the red component, G is the green component, and B is the blue component.

4. The method according to claim 1, wherein Step 3: Data reorganization and big-endian format generation: Perform the high-low byte swapping algorithm on the 10-bit YCbCr data to ensure that the byte order of the data meets the requirements of the big-endian format; the method is as follows: Step 31: Divide the 10-bit YCbCr data by 256 to obtain the high byte; Step 32: Obtain the low byte by subtracting the high byte multiplied by 256 from the input value; Step 33: Left-shift the low byte by 8 bits and perform a bitwise OR operation with the high byte to obtain the output value.

5. The method according to claim 1, characterized in that, Step 4: Generate a binary file for the test pattern; including: Sort the 10-bit YCbCr image data that conforms to the big-endian format according to the byte order of the YUV422p10be format and store it as a binary file; The byte sorting method of the YUV422p10be format is as follows: for the planar format with chroma subsampling, the Y component of each pixel is stored independently, and the Y components of every two pixels in the horizontal direction share the same set of Cb and Cr components; they are arranged in the order of the Y component with full resolution size, the Cb component with half of the full resolution size, and the Cr component with half of the full resolution size.

6. The method according to claim 1, wherein Step 5, video encapsulation output: Based on the generated YUV422p10be format binary file, it is encapsulated into an MP4 video stream through dynamic parameter matching and the FFmpeg framework to achieve adaptive output of multi-resolution and color gamut standards, including: Step 51, dynamically match the target specifications according to the input resolution parameters, associate the ultra-high definition with the BT.2020 transfer function, and associate the full high definition with the BT.709 transfer function; Step 52, call the test signal generation function to generate a binary file in the YUV422p10be format and store it in the specified path; Step 53, through the FFmpeg command-line tool, inject the resolution, pixel format, and encoder parameters to encapsulate the data into an MP4 format video stream.