Video frame color adjustment method and device based on Linux DRM, equipment and medium
By configuring the target Gamma lookup table and color transformation matrix through the Linux DRM subsystem, the problems of low latency, high performance, and secure rollback in color adjustment in cloud computer streaming are solved, thus meeting users' customized color needs and ensuring system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-15
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies struggle to achieve low-latency, high-performance, secure, and reversible color adjustments in cloud PC streaming. They pose risks such as difficulty in isolating parameters between tenants, policy leakage, or mutual interference, and it is difficult to meet users' customized color requirements.
By configuring the target Gamma lookup table and target color transformation matrix through the Linux DRM subsystem interface, the initial pixel data is color-adjusted, enabling temporary, session-level hardware-accelerated color adjustment, avoiding modification of the original video frame content and the introduction of additional rendering overhead.
In cloud computer streaming scenarios, it achieves low-latency, high-performance color adjustment, meets users' customized needs, and has security and recoverability, avoiding system-level color pollution and operational complexity.
Smart Images

Figure CN121865004A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, device, and medium for adjusting the color of video frames based on Linux DRM. Background Technology
[0002] With the popularization of cloud PC streaming services, client devices are gradually being simplified into "thin clients" that are only responsible for receiving video streams, local decoding, and outputting images. Meanwhile, users' personalized needs for image quality are becoming increasingly prominent, such as dynamically adjusting brightness and contrast based on ambient light, or fine-tuning color temperature and saturation according to visual preferences.
[0003] Current mainstream color enhancement solutions have significant shortcomings, struggling to balance real-time performance, resource efficiency, and system security. While adjusting graphics card configurations on the cloud host side can achieve embedded color effects, it triggers a reinitialization of the capture-encoder pipeline, leading to a decrease in screen capture frame rate. Increased encoding latency In cloud environments with multiple tenants sharing GPUs (Graphics Processing Units), there are risks of difficulty in isolating parameters between tenants, policy leakage, or mutual interference. When the client uses an OpenGL / Vulkan secondary rendering scheme, it needs to go through "decoding". Texture upload Shader execution Frame buffer write-back The entire "submit composition" process incurs additional GPU scheduling and full-frame texture write-back overhead for each frame. On low-end SoCs (System on Chip), this can easily lead to GPU utilization exceeding 90% and increased end-to-end latency. This could also cause frame drops, stuttering, and increased power consumption. Directly modifying display settings, however, has a global and persistent effect; if the client exits abnormally, color parameters cannot be automatically rolled back, easily affecting the local desktop and other application displays. This requires manual reset by the user, has a high operational threshold, and poses a risk of system-level color pollution.
[0004] In conclusion, how to achieve low latency, high performance, and secure, reversible color adjustments while ensuring a smooth cloud PC streaming experience is a pressing technical challenge that needs to be addressed. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a video frame color adjustment method, apparatus, device, and medium based on Linux DRM, which can achieve low-latency, high-performance, secure, and reversible color adjustment while ensuring a smooth cloud computer streaming experience. The specific solution is as follows: Firstly, this application provides a video frame color adjustment method based on Linux DRM, including: Receive target video frames transmitted by the target cloud computer, and decode the target video frames to obtain initial pixel data; The initial pixel data is written to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller; The target interface of the Linux DRM subsystem is used to configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller according to the preset color adjustment requirements. The initial pixel data is then color-adjusted based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment.
[0006] Optionally, writing the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller includes: The initial pixel data is written to the pre-allocated target frame buffer in the Linux DRM subsystem, and the corresponding display pipeline in the display output controller is generated.
[0007] Optionally, after generating the corresponding display pipeline in the display output controller, the method further includes: The target frame buffer is bound to the corresponding display layer in the display pipeline through the Atomic Commit interface or page-flip interface of the Linux DRM subsystem, and the initial pixel data in the target frame buffer is output in the display pipeline through the display layer so as to adjust the color of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix.
[0008] Optionally, configuring a target Gamma lookup table in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to preset color adjustment requirement information includes: Obtain the user's pre-set first preset color adjustment requirement information; the first preset color adjustment requirement information includes preset brightness parameters and preset contrast parameters; The initial mapping information corresponding to the three channels of the first preset color adjustment requirement information in the RGB color space is generated by using a linear offset function and a power function, and the initial mapping information is integrated to obtain the target Gamma lookup table. The target Gamma lookup table is written into the display pipeline of the display output controller via the ioctl interface of the Linux DRM subsystem.
[0009] Optionally, a target color transformation matrix is configured in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to preset color adjustment requirement information, including: Obtain the user's pre-set second preset color adjustment requirements information; the second preset color adjustment requirements information includes preset color style parameters and preset color gamut mapping requirements information; A linear transformation matrix corresponding to the second preset color adjustment requirement information is generated by using a predefined matrix, adjustment experience, and color science information, and the linear transformation matrix is converted into the target format to obtain the target color transformation matrix. The target color transformation matrix is written into the display pipeline of the display output controller via the Atomic Commit interface.
[0010] Optionally, the step of adjusting the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the color-adjusted target display data includes: Using preset display hardware, target pixel data is obtained by color adjustment of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix; The target pixel data is encoded and converted by a preset encoder to obtain the target display data, and the target display data is transmitted to the display for display through the target display interface.
[0011] Optionally, before configuring the target Gamma lookup table and target color transformation matrix in the display pipeline of the display output controller, the method further includes: The initial Gamma lookup table and initial color transformation matrix of the display output controller are queried; the initial Gamma lookup table is the unmodified Gamma lookup table in the display output controller, and the initial color transformation matrix is the unmodified color transformation matrix in the display output controller. Accordingly, after configuring the target Gamma lookup table and the target color transformation matrix in the display pipeline of the display output controller, the method further includes: If the session with the target cloud computer ends, the target Gamma lookup table in the display output controller is restored to the initial Gamma lookup table, and the target color transformation matrix is restored to the initial color transformation matrix.
[0012] Secondly, this application provides a video frame color adjustment device based on Linux DRM, comprising: The video frame receiving module is used to receive target video frames transmitted by the target cloud computer and decode the target video frames to obtain initial pixel data. The pixel data writing module is used to write the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller; The color adjustment module is used to configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to the preset color adjustment requirements information, and to perform color adjustment on the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the color-adjusted target display data.
[0013] Thirdly, this application provides an electronic device, comprising: Memory, used to store computer programs; A processor is used to execute the computer program to implement the aforementioned Linux DRM-based video frame color adjustment method.
[0014] Fourthly, this application provides a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned video frame color adjustment method based on Linux DRM.
[0015] In this application, firstly, target video frames transmitted from the target cloud computer are received and decoded to obtain initial pixel data. Then, the initial pixel data is written to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller. Finally, through the target interface of the Linux DRM subsystem, and according to preset color adjustment requirements, a target Gamma lookup table and a target color transformation matrix are configured in the display pipeline of the display output controller. Based on the target Gamma lookup table and the target color transformation matrix, the initial pixel data is color-adjusted to obtain the color-adjusted target display data. As can be seen, in this application, target video frames transmitted from the target cloud computer are first received and decoded to obtain initial pixel data, which is then written to the Linux DRM subsystem to generate the display pipeline corresponding to the display output controller. Subsequently, through the target interface of the Linux DRM subsystem, a target Gamma lookup table and a target color transformation matrix are configured in the display pipeline in conjunction with preset color adjustment requirements. The target Gamma lookup table and the target color transformation matrix work together to adjust the initial pixel data, ultimately obtaining the target display data. In this way, by directly utilizing the Linux DRM subsystem during the client display stage, and through the target Gamma lookup table and target color transformation matrix, this application can achieve temporary, session-level, and hardware-accelerated color adjustment of the display output signal without modifying the original video frame content or introducing additional rendering overhead. This ensures that in cloud computer streaming scenarios, the color adjustment meets the user's customized color needs while possessing low latency, high performance, and security and recoverability. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 This application provides a flowchart of a video frame color adjustment method based on Linux DRM; Figure 2 This application provides a schematic diagram of a video frame color adjustment device based on Linux DRM. Figure 3 This application provides a structural diagram of an electronic device. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] With the widespread adoption of cloud PC streaming services, client devices are gradually being simplified into "thin clients" responsible only for video stream reception, local decoding, and image output. Meanwhile, users' personalized demands for image quality are becoming increasingly prominent, such as dynamically adjusting brightness and contrast based on ambient light, or fine-tuning color temperature and saturation according to visual preferences. Current mainstream color enhancement solutions have significant shortcomings, struggling to balance real-time performance, resource efficiency, and system security. While adjusting the graphics card configuration on the cloud host side can achieve embedded color effects, it triggers a re-initialization of the capture-encoding pipeline, leading to a decrease in screen capture frame rate. Increased encoding latency In cloud environments with multi-tenant shared GPUs, there are risks of difficulty in isolating parameters between tenants, policy leakage, or mutual interference. When the client uses an OpenGL / Vulkan secondary rendering scheme, it needs to go through "decoding". Texture upload Shader execution Frame buffer write-back The entire "submit composition" process incurs additional GPU scheduling and full-frame texture write-back overhead for each frame, which can easily lead to GPU utilization exceeding 90% on low-end SoCs, increasing end-to-end latency. This can also lead to frame drops, stuttering, and increased power consumption. Directly modifying display configurations, however, has a global and persistent nature; if the client exits abnormally, color parameters cannot be automatically rolled back, easily affecting the local desktop and other application displays. This requires manual reset by the user, is technically challenging, and poses a risk of system-level color pollution. Therefore, this application provides a video frame color adjustment scheme based on Linux DRM, which can achieve low latency, high performance, and secure, rollback-enabled color adjustment while ensuring a smooth cloud computer streaming experience.
[0020] See Figure 1 As shown, this embodiment of the invention discloses a video frame color adjustment method based on Linux DRM, which may include: Step S11: Receive the target video frame transmitted by the target cloud computer and decode the target video frame to obtain initial pixel data.
[0021] In this embodiment, the client receives video frame data transmitted from the cloud computer host via a dedicated decoding module, typically in H.264 / H.265 encoded streams. After local hardware or software decoding, initial pixel data is obtained, with formats including NV12 and RGB.
[0022] Step S12: Write the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller.
[0023] In this embodiment, initial pixel data is written to the Linux DRM (Direct RenderingManager) subsystem to generate the corresponding display pipeline in the CRTC (Cathode Ray Tube Controller). The specific process may include: writing the initial pixel data to a pre-allocated target frame buffer in the Linux DRM subsystem and generating the corresponding display pipeline in the display output controller. Specifically, the decoded initial pixel data is directly submitted to the framebuffer or plane buffer of the Linux DRM subsystem. In this embodiment, the initial pixel data is written to the framebuffer, thereby mapping the initial pixel data to DRM_FB, i.e., DRM-recognizable memory. The framebuffer is managed by the DRM KMS (Kernel Mode Setting).
[0024] It should be noted that after generating the corresponding display pipeline in the display output controller, the process may further include: binding the target frame buffer to the corresponding display layer in the display pipeline through the Atomic Commit interface or page-flip interface of the Linux DRM subsystem, and outputting the initial pixel data in the target frame buffer through the display layer in the display pipeline, so as to adjust the color of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix. Specifically, in this embodiment, the target memory data can be bound to the corresponding display layer Plane in the display pipeline through the Atomic Commit interface or legacy page-flip interface of the Linux DRM subsystem, and CRTC can be triggered to update the screen; wherein, the Atomic Commit interface or page-flip interface can achieve low-latency, VSync (Vertical Synchronization) aligned frame submission, ensuring smooth and tear-free screen.
[0025] Step S13: Configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to the preset color adjustment requirements information. Then, adjust the color of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment.
[0026] In this embodiment, to achieve dynamic brightness and contrast adjustment, the client can configure a target Gamma lookup table in the display pipeline of the display output controller without modifying the physical configuration of the display, such as EDID (Extended Display Identification Data) and DDC / CI (Display Data Channel Command Interface) control commands. This can be done through the target interface of the Linux DRM subsystem and based on preset color adjustment requirements. The specific process may include: first, obtaining the user-preset first preset color adjustment requirements; the first preset color adjustment requirements include preset brightness parameters and preset contrast parameters; then, generating initial mapping information corresponding to the three channels of the RGB color space for the first preset color adjustment requirements using a linear offset function and a power function, and integrating the initial mapping information to obtain the target Gamma lookup table; finally, writing the target Gamma lookup table into the display pipeline of the display output controller through the ioctl interface of the Linux DRM subsystem.
[0027] Specifically, the process first obtains the user's pre-set color adjustment requirements, such as brightness and contrast parameters. Then, using mathematical functions, such as linear offset and power functions, initial mapping information for the R, G, and B channels in the RGB color space is generated, ensuring it's within the size and range supported by the DRM. Next, the initial mapping information is integrated to obtain the target Gamma LUT (Look-Up Table). That is, the Gamma LUT is a function table that maps input pixel values, typically 0 to 255 or 0 to 65535, to output pixel values. It operates on the red (R), green (G), and blue (B) channels to adjust the overall brightness, contrast, color temperature, or non-linear response of the image. Finally, the target Gamma LUT can be written to the current CRTC display pipeline via the DRM-provided ioctl interface DRM_IOCTL_MODE_SETGAMMALUT. It should be noted that the target Gamma LUT only applies to the display pipeline bound to the current DRM session and does not affect other display output devices; all parameters reside in the register cache of the kernel graphics driver and are not written to the display firmware, EDID data, or physical device registers; Gamma adjustment effects take effect in real time, and hardware acceleration capabilities are also available if the GPU supports it; when the client exits or the session terminates, the system automatically or the client explicitly calls the recovery logic to reset the Gamma LUT to the default linear mapping, i.e. .
[0028] In this embodiment, to further support advanced color stylization, such as cool tones, warm tones, cinematic mode, grayscale mode, etc., the client can configure a target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to preset color adjustment requirements. The specific process may include: first, obtaining the second preset color adjustment requirements information pre-set by the user; the second preset color adjustment requirements information includes preset color style parameters and preset color gamut mapping requirements information; then, generating a linear transformation matrix corresponding to the second preset color adjustment requirements information through a predefined matrix, adjustment experience, and color science information, and converting the linear transformation matrix into a target format to obtain the target color transformation matrix; finally, writing the target color transformation matrix into the display pipeline of the display output controller through the Atomic Commit interface.
[0029] Specifically, the process first obtains the user's pre-defined second preset color adjustment requirements, such as color style and color gamut mapping needs. Then, it calculates and generates the corresponding... A linear transformation matrix is generated and converted to the S31.32 fixed-point format required by DRM to obtain the target CTM (Color Transformation Matrix). Finally, the target CTM can be written to the CRTC display pipeline via the DRM_MODE_OBJECT_CTM attribute object using DRM's native color management interface, Atomic Commit. It should be noted that the CTM is a... A matrix is used to transform linear RGB signals, correcting deviations in primary colors or white point. Its function is similar to "color correction," mapping the source color space, such as BT.709, to the actual physical color gamut of the display, i.e., primary colors and white point. The target CTM takes effect within the Atomic Modeset framework of the DRM. The transformations generated by the target CTM only affect the currently bound display pipeline and do not interfere with the system's global color configuration, such as ICC profiles, Wayland / X11 color management services, or other output ports. It supports floating-point precision matrix coefficients, typically transmitted in S31.32 fixed-point format, enabling fine-grained color gamut rotation, saturation scaling, and white point offset.
[0030] In one specific implementation, the target CTM is a saturation adjustment matrix. Taking BT709 as an example, the saturation interpolation formula is as follows: ; 0.213, 0.787, and 0.072 are the weights for constant brightness (Y) in the RGB-to-luminance conversion.
[0031] [0.213+0.787s, 0.715-0.715s, 0.072-0.072s]; [0.213-0.213s, 0.715+0.285s, 0.072-0.072s]; [0.213-0.213s, 0.715-0.715s, 0.072+0.928s]; The reference values for the saturation parameter s are shown below: (Original color remains unchanged) (Completely grayscale, similar to a black and white television); Supersaturation (amplifying differences and increasing saturation); It will produce a reverse / strange effect (leaning towards cool colors).
[0032] It should be noted that the process of adjusting the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment can include: firstly, using preset display hardware, adjusting the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain target pixel data; then, encoding and converting the target pixel data through a preset encoder to obtain the target display data, and transmitting the target display data to the display through the target display interface for display.
[0033] Specifically, this embodiment utilizes preset display hardware, a target Gamma lookup table, and a target color transformation matrix to work together, forming a complete "CTM+Gamma" color processing pipeline. The order in which the target CTM and the target Gamma lookup table function is determined by the display hardware. In this way, the display hardware can complete brightness mapping, color space transformation, and color enhancement processing in the scan output path before the encoder, obtaining color-adjusted target pixel data. Then, the encoder can perform color encoding conversion on the target pixel data to obtain target display data, which is then output to the target display interface. Through a connector such as HDMI (High-Definition Multimedia Interface) or DP (DisplayPort), the target display data is transmitted to the monitor for display. In specific embodiments, different enhancement effects can be achieved by configuring different Gamma, contrast, brightness LUTs, and CTM matrix parameters.
[0034] It is understood that, in this embodiment, by directly utilizing the Gamma LUT curve interface and CTM color transformation matrix interface provided by the DRM subsystem during the client display stage, temporary, session-level, and hardware-accelerated color adjustments to the display output signal can be achieved without modifying the original video frame content or introducing additional rendering overhead. The color adjustments in this embodiment do not modify the host-side graphics card or encoding configuration, and do not affect acquisition and compression efficiency; they avoid secondary rendering operations such as OpenGL or Vulkan, significantly reducing client CPU / GPU load and frame latency; they do not modify the global Gamma and color configuration of the display or system, but only affect the DRM display pipeline layer; and they are suitable for various Linux DRM backend and cloud PC client environments.
[0035] As can be seen, the video stream processing flow is as follows: video frames (decoded YUV) Mapped to DRM_FB (DRM-recognizable memory). Bind to the display layer Plane; the display stream processing flow is: Plane (primary color) CRTC (Display Controller) Encoder (performs color encoding conversion, etc.) Connector (HDMI, DP, etc.)
[0036] In this embodiment, to ensure the stability of the system display state and the consistency of user experience, before configuring the target Gamma lookup table and target color transformation matrix in the display pipeline of the display output controller, the following steps may be taken: querying the initial Gamma lookup table and initial color transformation matrix of the display output controller; the initial Gamma lookup table is the unmodified Gamma lookup table in the display output controller, and the initial color transformation matrix is the unmodified color transformation matrix in the display output controller; correspondingly, after configuring the target Gamma lookup table and target color transformation matrix in the display pipeline of the display output controller, the following steps may be taken: if the session with the target cloud computer ends, the target Gamma lookup table in the display output controller is restored to the initial Gamma lookup table, and the target color transformation matrix is restored to the initial color transformation matrix. Specifically, the client performs the following operations at the initial stage of establishing the cloud computer connection: 1. State Snapshot: Query and save the current CRTC default initial Gamma LUT and initial CTM matrix through DRM_IOCTL_MODE_GETGAMMALUT and drmModeObjectGetProperties; 2. Anomaly protection: Register process exit signal handlers, such as SIGTERM and SIGINT, and crash monitoring, such as via prctl or systemd notify; 3. Automatic Recovery: When the client-cloud computer session ends, regardless of whether the session is closed normally or interrupted abnormally (e.g., process crash, forced kill, network disconnection), the target Gamma and target CTM are reset to their initial snapshot values. In the case of abnormal exit, the system automatically releases resources. This way, since color adjustment is processed at the process level, recovery logic can be triggered when the session closes normally or when display effects are no longer needed, without affecting other applications or system-level display parameters. Even in non-graceful exit scenarios, the user's local monitor will not retain abnormal color states. In other words, regardless of whether the session exits normally or terminates abnormally, modifications to color, hue, brightness, contrast, etc., only take effect in the current process; after exiting, the original color style is restored.
[0037] As can be seen from the above, in this embodiment, the target video frame transmitted by the target cloud computer is first received and decoded to obtain initial pixel data. Then, the initial pixel data is written to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller. Finally, through the target interface of the Linux DRM subsystem, and according to preset color adjustment requirements, a target Gamma lookup table and a target color transformation matrix are configured in the display pipeline of the display output controller. Based on the target Gamma lookup table and the target color transformation matrix, the initial pixel data is color-adjusted to obtain the color-adjusted target display data. As can be seen from the above, in this embodiment, the target video frame transmitted by the target cloud computer is first received and decoded to obtain initial pixel data, which is then written to the Linux DRM subsystem to generate the display pipeline corresponding to the display output controller. Subsequently, through the target interface of the Linux DRM subsystem, and in conjunction with preset color adjustment requirements, a target Gamma lookup table and a target color transformation matrix are configured in the display pipeline. The target Gamma lookup table and the target color transformation matrix work together to adjust the initial pixel data, ultimately obtaining the target display data. In this way, by directly utilizing the Linux DRM subsystem during the client display stage, and through the target Gamma lookup table and target color transformation matrix, temporary, session-level, and hardware-accelerated color adjustments to the display output signal can be achieved without modifying the original video frame content or introducing additional rendering overhead. This ensures that in cloud computer streaming scenarios, color adjustments meet the user's customized color requirements while possessing low latency, high performance, and security and recoverability.
[0038] Accordingly, see Figure 2 As shown in the figure, this application embodiment also provides a video frame color adjustment device based on Linux DRM, which may include: The video frame receiving module 11 is used to receive the target video frame transmitted by the target cloud computer and decode the target video frame to obtain the initial pixel data. The pixel data writing module 12 is used to write the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller; The color adjustment module 13 is used to configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to the preset color adjustment requirement information, and to perform color adjustment on the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment.
[0039] In some specific embodiments, the pixel data writing module 12 may include: The pixel data writing unit is used to write the initial pixel data to the target frame buffer pre-allocated in the Linux DRM subsystem and generate the corresponding display pipeline in the display output controller.
[0040] In some specific embodiments, the Linux DRM-based video frame color adjustment device may further include: The pixel data output module is used to bind the target frame buffer to the corresponding display layer in the display pipeline through the Atomic Commit interface or page-flip interface of the Linux DRM subsystem, and output the initial pixel data in the target frame buffer through the display layer in the display pipeline so as to perform color adjustment on the initial pixel data based on the target Gamma lookup table and the target color transformation matrix.
[0041] In some specific embodiments, the color adjustment module 13 may include: The first demand information acquisition unit is used to acquire the first preset color adjustment demand information preset by the user; the first preset color adjustment demand information includes preset brightness parameters and preset contrast parameters. The lookup table determination unit is used to generate initial mapping information corresponding to the three channels of the first preset color adjustment requirement information in the RGB color space through a linear offset function and a power function, and to integrate the initial mapping information to obtain the target Gamma lookup table. The lookup table writing unit is used to write the target Gamma lookup table into the display pipeline of the display output controller through the ioctl interface of the Linux DRM subsystem.
[0042] In some specific embodiments, the color adjustment module 13 may include: The second requirement information acquisition unit is used to acquire the second preset color adjustment requirement information pre-set by the user; the second preset color adjustment requirement information includes preset color style parameters and preset color gamut mapping requirement information. The color transformation matrix determination unit is used to generate a linear transformation matrix corresponding to the second preset color adjustment requirement information through a predefined matrix, adjustment experience and color science information, and convert the linear transformation matrix into the target format to obtain the target color transformation matrix; The color transformation matrix writing unit is used to write the target color transformation matrix into the display pipeline of the display output controller via the Atomic Commit interface.
[0043] In some specific embodiments, the color adjustment module 13 may include: A color adjustment unit is used to adjust the color of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix using preset display hardware to obtain target pixel data. The display data transmission unit is used to encode and convert the target pixel data through a preset encoder to obtain the target display data, and to transmit the target display data to the display through the target display interface for display.
[0044] In some specific embodiments, the color adjustment module 13 may be preceded by: The color transformation matrix query module is used to query the initial Gamma lookup table and the initial color transformation matrix of the display output controller; the initial Gamma lookup table is the unmodified Gamma lookup table in the display output controller, and the initial color transformation matrix is the unmodified color transformation matrix in the display output controller; Accordingly, after the color adjustment module 13, it may also include: The color transformation matrix recovery module is used to restore the target Gamma lookup table in the display output controller to the initial Gamma lookup table and the target color transformation matrix to the initial color transformation matrix if the session with the target cloud computer ends.
[0045] Furthermore, embodiments of this application also disclose an electronic device, Figure 3 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the Linux DRM-based video frame color adjustment method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0046] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0047] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0048] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the Linux DRM-based video frame color adjustment method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.
[0049] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned Linux DRM-based video frame color adjustment method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0050] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0051] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0052] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0053] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0054] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A video frame color adjustment method based on Linux DRM, characterized in that, include: Receive target video frames transmitted by the target cloud computer, and decode the target video frames to obtain initial pixel data; The initial pixel data is written to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller; The target interface of the Linux DRM subsystem is used to configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller according to the preset color adjustment requirements. The initial pixel data is then color-adjusted based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment.
2. The video frame color adjustment method based on Linux DRM according to claim 1, characterized in that, The step of writing the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller includes: The initial pixel data is written to the pre-allocated target frame buffer in the Linux DRM subsystem, and the corresponding display pipeline in the display output controller is generated.
3. The video frame color adjustment method based on Linux DRM according to claim 2, characterized in that, After generating the corresponding display pipeline in the display output controller, the method further includes: The target frame buffer is bound to the corresponding display layer in the display pipeline through the Atomic Commit interface or page-flip interface of the Linux DRM subsystem, and the initial pixel data in the target frame buffer is output in the display pipeline through the display layer so as to adjust the color of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix.
4. The video frame color adjustment method based on Linux DRM according to claim 1, characterized in that, The step of configuring a target Gamma lookup table in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to preset color adjustment requirement information includes: Obtain the user's pre-set first preset color adjustment requirement information; the first preset color adjustment requirement information includes preset brightness parameters and preset contrast parameters; The initial mapping information corresponding to the three channels of the first preset color adjustment requirement information in the RGB color space is generated by using a linear offset function and a power function, and the initial mapping information is integrated to obtain the target Gamma lookup table. The target Gamma lookup table is written into the display pipeline of the display output controller via the ioctl interface of the Linux DRM subsystem.
5. The video frame color adjustment method based on Linux DRM according to claim 1, characterized in that, Configure the target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to the preset color adjustment requirement information, including: Obtain the user's pre-set second preset color adjustment requirements information; the second preset color adjustment requirements information includes preset color style parameters and preset color gamut mapping requirements information; A linear transformation matrix corresponding to the second preset color adjustment requirement information is generated by using a predefined matrix, adjustment experience, and color science information, and the linear transformation matrix is converted into the target format to obtain the target color transformation matrix. The target color transformation matrix is written into the display pipeline of the display output controller via the Atomic Commit interface.
6. The video frame color adjustment method based on Linux DRM according to claim 1, characterized in that, The step of adjusting the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the color-adjusted target display data includes: Using preset display hardware, target pixel data is obtained by color adjustment of the initial pixel data based on the target Gamma lookup table and the target color transformation matrix; The target pixel data is encoded and converted by a preset encoder to obtain the target display data, and the target display data is transmitted to the display for display through the target display interface.
7. The video frame color adjustment method based on Linux DRM according to any one of claims 1 to 6, characterized in that, Before configuring the target Gamma lookup table and target color transformation matrix in the display pipeline of the display output controller, the method further includes: The initial Gamma lookup table and initial color transformation matrix of the display output controller are queried; the initial Gamma lookup table is the unmodified Gamma lookup table in the display output controller, and the initial color transformation matrix is the unmodified color transformation matrix in the display output controller. Accordingly, after configuring the target Gamma lookup table and the target color transformation matrix in the display pipeline of the display output controller, the method further includes: If the session with the target cloud computer ends, the target Gamma lookup table in the display output controller is restored to the initial Gamma lookup table, and the target color transformation matrix is restored to the initial color transformation matrix.
8. A video frame color adjustment device based on Linux DRM, characterized in that, include: The video frame receiving module is used to receive target video frames transmitted by the target cloud computer and decode the target video frames to obtain initial pixel data. The pixel data writing module is used to write the initial pixel data to the Linux DRM subsystem to generate the corresponding display pipeline in the display output controller; The color adjustment module is used to configure a target Gamma lookup table and a target color transformation matrix in the display pipeline of the display output controller through the target interface of the Linux DRM subsystem and according to the preset color adjustment requirements information, and to perform color adjustment on the initial pixel data based on the target Gamma lookup table and the target color transformation matrix to obtain the target display data after color adjustment.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory; wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the Linux DRM-based video frame color adjustment method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the video frame color adjustment method based on Linux DRM as described in any one of claims 1 to 7.