Video coding and decoding adjustment method and device, equipment and readable storage medium
By monitoring the video codec firmware status, adjusting the processor operating parameters and codec queue priority, the video codec and power consumption balance problems are solved, improving the codec efficiency and reducing power consumption, realizing processor performance and battery Optimization of battery life.
Patent Information
- Application Number
- CN202411215190.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-15
AI Technical Summary
The prior art is difficult to fully utilize the processor hardware performance during video encoding and decoding, while taking into account the balance of equipment power consumption and temperature, resulting in low encoding and decoding efficiency.
By monitoring the instantiation status of the video codec firmware, adjusting the operating parameters, codec queues and codec processing tasks of the hardware processor to improve efficiency under high load conditions and reduce power consumption under low load conditions, achieving video Balancing of codec and power consumption.
Improve video encoding and decoding efficiency under high load conditions, reduce power consumption, achieve a balance between processor performance and power consumption, and improve overall system performance and battery life.
Smart Images

Figure CN118972606A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of video coding and decoding, and specifically relates to a method, device, equipment and readable storage medium for adjusting video coding and decoding. Background Art
[0002] When performing video encoding and decoding on electronic devices, in order to balance the power consumption and temperature of the device, conservative processor (such as graphics processing unit (GPU) and video processing unit (VPU)) performance strategies are usually adopted to reduce power consumption and avoid overheating. However, although this strategy can reduce power consumption and avoid overheating, it limits the full use of processor hardware performance, resulting in the inability to effectively implement video encoding and decoding. In this case, how to achieve a balance between video encoding and decoding and power consumption is an urgent problem to be solved. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, apparatus, device and readable storage medium for adjusting video codec to solve the problem of how to achieve a balance between video codec and power consumption.
[0004] In order to solve the above technical problems, this application is implemented as follows:
[0005] In a first aspect, a video codec adjustment method is provided, which is applied to an electronic device and includes:
[0006] Monitor the instantiation status of the video codec firmware;
[0007] According to the instantiation state, a first operation is performed; wherein the first operation includes at least one of the following: adjusting operating parameters of a hardware processor, adjusting a codec queue, and adjusting a priority of a coding processing task.
[0008] Optionally, if the instantiation state is creating a video codec instance, the performing of the first operation includes at least one of the following:
[0009] adjusting an operating parameter of the hardware processor to a first operating parameter, wherein the first operating parameter is used to enhance the performance of the hardware processor;
[0010] Increasing the number of the codec queues, and / or increasing the priority of the codec input thread and / or the codec output thread corresponding to the codec queue;
[0011] Raise the priority of the encoding processing task.
[0012] Optionally, before performing the first operation, the method further includes:
[0013] Monitor whether the processor load is greater than a preset threshold;
[0014] The executing the first operation includes: when it is monitored that the processor load is greater than a preset threshold, executing the first operation.
[0015] Optionally, if the instantiation state is to destroy the video codec instance, the performing of the first operation includes at least one of the following:
[0016] adjusting an operating parameter of the hardware processor to a second operating parameter, wherein the second operating parameter is used to reduce the performance of the hardware processor;
[0017] Reducing the number of the codec queues, and / or lowering the priority of the codec input thread and / or codec output thread corresponding to the codec queue;
[0018] Lowering the priority of the encoding processing task.
[0019] Optionally, the hardware processor includes at least one of the following:
[0020] Graphics processor GPU, video processing unit VPU.
[0021] Optionally, the encoding processing task includes: color space conversion.
[0022] In a second aspect, a video codec adjustment device is provided, which is applied to an electronic device, including:
[0023] A first monitoring module, used to monitor the instantiation state of the video codec firmware;
[0024] An execution module is used to perform a first operation according to the instantiation state; wherein the first operation includes at least one of the following: adjusting the operating parameters of the hardware processor, adjusting the encoding and decoding queue, and adjusting the priority of the encoding processing task.
[0025] In a third aspect, an electronic device is provided, comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0026] In a fourth aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0027] In a fifth aspect, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0028] In the embodiment of the present application, the instantiation state of the video codec firmware can be monitored, and according to the instantiation state, at least one of the following can be performed: adjusting the operating parameters of the hardware processor, adjusting the codec queue, and adjusting the priority of the encoding processing task. Thus, with the help of the adjustment operation, the video codec efficiency can be improved under high load conditions, and the power consumption can be reduced under low load conditions, thereby achieving a balance between video codec and power consumption. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 is a flowchart of a video encoding and decoding adjustment method provided in an embodiment of the present application;
[0030] Figure 2 is a flowchart of adjusting the working mode of the GPU in an embodiment of the present application;
[0031] Figure 3 is a flow chart of adjusting the working mode of the VPU in an embodiment of the present application;
[0032] Figure 4 is a flow chart of the adaptive scheduling process in an embodiment of the present application;
[0033] Figure 5A This is a schematic diagram of the encoding time consumption before the optimization scheme in this application is adopted;
[0034] Figure 5B This is a schematic diagram of the encoding time consumption after optimization using the solution in this application;
[0035] Figure 5C It is a schematic diagram comparing the encoding time consumption before and after optimization using the solution in this application;
[0036] Figure 6 It is a structural diagram of a video encoding and decoding adjustment device provided in an embodiment of the present application;
[0037] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more.
[0040] In conjunction with the accompanying drawings, the video encoding and decoding adjustment method, device, equipment and readable storage medium provided in the embodiments of the present application are described in detail through specific embodiments and their application scenarios.
[0041] See also Figure 1 , Figure 1 This is a flowchart of a video codec adjustment method provided in an embodiment of the present application. The method is applied to an electronic device on which an Android system, etc. can be run.
[0042] like Figure 1 As shown, the method comprises the following steps:
[0043] Step 11: Monitor the instantiation status of the video codec firmware;
[0044] Step 12: Execute a first operation according to the instantiation state; the first operation includes at least one of the following: adjusting operating parameters of a hardware processor, adjusting a codec queue, and adjusting a priority of a coding processing task.
[0045] In the embodiment of the present application, the video codec firmware can be understood as a video codec program.
[0046] The instantiation state may be selected as creating a video codec instance or destroying a video codec instance, etc. For example, in a specific implementation, the monitoring module may continuously detect whether the video codec firmware is instantiated, wherein if it is not instantiated, the detection is repeated, and once the video codec firmware is detected to be instantiated, the scheduling module may be notified of the instantiation (creating a video codec instance) or de-instantiation (destroying a video codec instance) message, and the scheduling module performs the corresponding adjustment operation.
[0047] Optionally, the hardware processor may include at least one of the following: a graphics processor GPU, a video processing unit VPU. When adjusting the operating parameters of the hardware processor, the performance of the hardware processor may be enhanced to improve the efficiency of video encoding and decoding; the performance of the hardware processor may also be weakened to reduce the power consumption of related hardware.
[0048] Optionally, the codec queue can be used to store the image cache (Buffer) for coding and decoding. The codec input thread and the codec output thread share a codec queue, wherein the codec input thread is used to fill data into the codec queue, and the codec output thread is used to extract / consume data from the codec queue. The codec queue is the medium for transferring data between the codec input thread and the codec output thread. When the codec queue is adjusted, the video coding process can be adjusted accordingly, so as to achieve a balance between video coding and power consumption. For example, the codec queue can be selected as an Open Media Acceleration (OpenMAX or OMX) queue. OMX is a component of the codec in the Android system and is used for coding and decoding processing; OMX threads can be divided into codec input threads and codec output threads.
[0049] Optionally, the encoding processing tasks may include but are not limited to color space conversion. Color space conversion is one of the processing processes of video encoding. For example, the image input format of Android screen recording encoding is RGBA8888, but some codec chips do not support the image input format of RGBA8888 and require the image input format to be NV12 for encoding. At this time, the image input format RGBA8888 needs to be converted to NV12, which is the color space conversion. Color space conversion is accelerated using the GPU. The GPU is responsible for tasks such as encoding, rendering, and color space conversion. If the priority of the color space conversion task is too low, it will affect the overall encoding efficiency. Therefore, the encoding efficiency can be improved by increasing the priority of the color space conversion task.
[0050] In an optional implementation, the operating parameters of the hardware processor may be adjusted according to the instantiation state of the video codec firmware.
[0051] In another optional implementation, the codec queue may be adjusted, or the priority of the encoding processing task may be adjusted according to the instantiation state of the video codec firmware.
[0052] In another optional implementation, based on the instantiation state of the video codec firmware, the operating parameters of the hardware processor can be adjusted and the codec queue can be adjusted, or the operating parameters of the hardware processor can be adjusted and the priority of the encoding processing task can be adjusted, or the codec queue can be adjusted and the priority of the encoding processing task can be adjusted.
[0053] In another optional implementation, according to the instantiation state of the video codec firmware, the operating parameters of the hardware processor, the codec queue, and the priority of the encoding processing task may be adjusted.
[0054] Optionally, applicable scenarios of the embodiments of the present application include but are not limited to cloud phones, cloud games, cloud virtual reality (VR) / augmented reality (AR), cloud rendering, etc.
[0055] Through the solution in the embodiment of the present application, the instantiation state of the video codec firmware can be monitored, and according to the instantiation state, at least one of the following can be performed: adjusting the operating parameters of the hardware processor, adjusting the codec queue, and adjusting the priority of the encoding processing task. Thus, with the help of the adjustment operation, the video codec efficiency can be improved under high load conditions, and the power consumption can be reduced under low load conditions, thereby achieving a balance between video codec and power consumption.
[0056] Optionally, if the instantiation state is to create a video codec instance, the video codec instance can be used to encode and decode the video according to the codec algorithm through the codec, and the performing of the first operation may include at least one of the following:
[0057] (1) Adjusting the operating parameters of a hardware processor (such as a GPU and / or a VPU) to first operating parameters, where the first operating parameters are used to enhance the performance of the hardware processor; for example, in order to adjust the operating parameters of the hardware processor, multiple operating modes can be set for the hardware processor, and different operating modes correspond to different operating parameters, so that the operating parameters can be adjusted by adjusting the operating mode.
[0058] (2) Increase the number of codec queues, and / or increase the priority of the codec input thread and / or codec output thread corresponding to the codec queue; wherein, since the codec input thread and the codec output thread share a codec queue, that is, they share the cache in the codec queue, if the codec output thread occupies all the cache, then the codec input thread will have no cache available, thereby entering a blocking state and causing waiting and increasing time consumption. At this time, by increasing the number of codec queues, space can be exchanged for time so that the codec input thread and the codec output thread have enough cache available, and there is no need to wait and increase time consumption due to cache competition, thereby helping to reduce time consumption and improve video codec efficiency. In addition, by increasing the number of codec queues, when the central processing unit (CPU) load is too high, the image cache transmission blockage can be reduced to avoid affecting system scheduling. By increasing the priority of the codec input thread and / or output thread, when the CPU load is too high, the codec input thread and / or output thread can be given priority in CPU scheduling, thereby improving video codec efficiency.
[0059] In an optional implementation, the number of codec queues may be adjusted and / or the priority of a codec input thread and / or output thread may be increased by modifying a codec configuration file.
[0060] (3) Raising the priority of the encoding processing task. For example, the encoding processing task is color space conversion. In this way, when the GPU load is too high, the encoding processing task (such as color space conversion) can be processed first, thereby improving the video encoding and decoding efficiency.
[0061] In an optional implementation, it is possible to detect at the GPU driver layer whether the data consumption type is an OMX instance, an encoding message thread, or a color space conversion type, and if so, the priority of the color space conversion is increased.
[0062] With the help of the above adjustments (1) to (3), the efficiency of video encoding and decoding can be improved when there is a demand for video encoding and decoding.
[0063] It is understandable that for the above (1) to (3), at least two items can be executed simultaneously. For example, when creating a video codec instance, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the first operating parameters and the number of codec queues can be increased; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the first operating parameters and the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be increased; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the first operating parameters and the priority of the encoding processing task can be increased; or, the number of codec queues can be increased (or, the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be increased) and the priority of the encoding processing task can be increased; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the first operating parameters, the number of codec queues can be increased (or, the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be increased) and the priority of the encoding processing task can be increased.
[0064] In an embodiment of the present application, in order to avoid the above adjustments (1) to (3) causing excessive power consumption of the device, the processor load can be continuously monitored, and when the processor load is detected to be greater than a preset threshold, the above adjustments (1) to (3) are executed.
[0065] Optionally, before performing the first operation, the adjustment method in this embodiment may further include:
[0066] Monitor whether the processor load is greater than a preset threshold. For example, the processor may be a GPU, a VPU, a CPU, etc. The preset threshold may be set based on actual needs and is not limited thereto.
[0067] The above-mentioned execution of the first operation includes: when the processor load is monitored to be greater than a preset threshold, the first operation is executed. In this way, by monitoring the processor load and executing the first operation only when the processor load is greater than the preset threshold, excessive power consumption of the device can be avoided.
[0068] In an optional implementation, the CPU load can be monitored, and when the CPU load is greater than a preset threshold, the number of codec queues is increased, and / or the priority of the codec input thread and / or codec output thread corresponding to the codec queue is increased; if the CPU load is not greater than the preset threshold (i.e., less than or equal to the preset threshold), no adjustment operation is performed.
[0069] In another optional implementation, the GPU load can be monitored, and when the GPU load is greater than a preset threshold, the priority of the color space conversion is increased; if the GPU load is not greater than the preset threshold (ie, less than or equal to the preset threshold), no adjustment operation is performed.
[0070] Optionally, if the instantiation state is to destroy the video codec instance, the performing of the first operation may include at least one of the following:
[0071] (a) adjusting the operating parameters of a hardware processor (such as a GPU and / or a VPU) to second operating parameters, where the second operating parameters are used to reduce the performance of the hardware processor; for example, in order to adjust the operating parameters of the hardware processor, multiple operating modes can be set for the hardware processor, and different operating modes correspond to different operating parameters, so that the operating parameters can be adjusted by adjusting the operating mode.
[0072] (b) reducing the number of codec queues, and / or lowering the priority of the codec input thread and / or codec output thread corresponding to the codec queue; by reducing the number of codec queues, the system memory usage can be reduced, thereby reducing power consumption.
[0073] In an optional implementation, the number of codec queues may be adjusted and / or the priority of a codec input thread and / or output thread may be lowered by modifying a codec configuration file.
[0074] (c) Lowering the priority of the encoding processing task. For example, the encoding processing task is color space conversion. In this way, when the GPU load is low, by lowering the priority (such as color space conversion), power consumption can be reduced without affecting the encoding operation.
[0075] By means of the above adjustments (a) to (c), the power consumption of related hardware can be reduced when there is no video encoding or decoding requirement.
[0076] It is understandable that for the above (a) to (c), at least two items can be executed simultaneously. For example, in the case of destroying the video codec instance, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the second operating parameters and the number of codec queues can be reduced; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the second operating parameters and the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be reduced; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the second operating parameters and the priority of the encoding processing task can be reduced; or, the number of codec queues can be reduced (or, the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be reduced) and the priority of the encoding processing task can be reduced; or, the operating parameters of the hardware processor (such as GPU and / or VPU) can be adjusted to the second operating parameters, the number of codec queues can be reduced (or, the priority of the codec input thread and / or codec output thread corresponding to the codec queue can be reduced) and the priority of the encoding processing task can be reduced.
[0077] In an optional implementation, in order to adjust the operating parameters of the GPU, the GPU may be divided into three working modes, as shown below:
[0078] 1) High-performance mode: The GPU runs at maximum power consumption and highest clock frequency to provide the best performance. This is usually suitable for tasks that require high-intensity graphics processing. When the GPU runs in high-performance mode, it can improve rendering efficiency, improve the efficiency of encoding input source format conversion, etc., thereby making the video encoding input source more stable and improving video encoding and decoding efficiency.
[0079] 2) Energy-saving mode: Energy-saving mode aims to reduce the power consumption and heat generation of the GPU, and achieves energy saving by reducing the clock frequency and voltage to weaken the performance. This mode is suitable for scenarios that do not require high performance, such as browsing the web, editing documents, or watching videos. When the GPU runs in energy-saving mode, it can reduce device power consumption and reduce device heat generation.
[0080] 3) Balanced mode: Balanced mode (also called balanced mode) is a mode between high-performance mode and energy-saving mode. Balanced mode aims to find a balance between performance and power consumption. It is suitable for daily use and can meet the needs of most users while maintaining reasonable power consumption and noise levels. In balanced mode, the performance and power consumption of the GPU can be dynamically adjusted according to the needs of the current task. When the GPU runs in balanced mode, it can keep the corresponding device balanced between rendering, encoding and decoding, and power consumption.
[0081] In the three working modes 1) to 3) above, the working mode of the GPU can be adjusted according to business needs / scenarios, thereby adjusting the operating parameters of the GPU.
[0082] For example Figure 2 As shown, the specific adjustment process may include:
[0083] S1: Based on event triggering, such as creating a video codec instance and needing to improve codec efficiency, execute an instruction to query the GPU working mode to obtain the current working mode of the GPU; this instruction can be issued by the system program;
[0084] S2: Determine whether the GPU working mode needs to be adjusted, and set the GPU to a high-performance mode if adjustment is required; for example, if the current working mode of the GPU is a power-saving mode or a balanced mode, it needs to be adjusted to a high-performance mode;
[0085] S3: In response to the system instruction, query the GPU working mode to detect whether the GPU is adjusted to a high-performance mode.
[0086] In another optional implementation, in order to adjust the operating parameters of the VPU, the VPU may be divided into three working modes. The three working modes mainly achieve different performance and power consumption levels by adjusting the operating frequency, voltage and system resource allocation of the VPU. The three working modes are as follows:
[0087] a) High-performance mode: The VPU runs at the highest operating frequency to provide maximum processing power. This is usually suitable for scenarios with high video processing requirements, such as high-definition video encoding and decoding, 3D rendering, or video games. In this mode, the VPU has the strongest performance. When the VPU runs in high-performance mode, because the video encoding and decoding related algorithms are calculated on the VPU, increasing the VPU's main frequency indirectly improves the efficiency of video encoding and decoding.
[0088] b) Energy-saving mode: Compared with high-performance mode, the VPU will reduce the operating frequency and voltage to reduce power consumption and heat generation. This is usually suitable for daily use scenarios that do not require high performance, such as web browsing, document editing, or watching decoded videos. This mode helps to extend the battery life of the device while maintaining a lower operating temperature. When the VPU runs in energy-saving mode, it can reduce device power consumption and reduce device heat generation.
[0089] c) Balanced mode (also called balanced mode): Balanced mode is designed to provide a compromise between performance and power consumption. According to the current task requirements, the VPU can automatically adjust its operating frequency and voltage to balance performance and power consumption. This mode is suitable for daily use by most users and can adapt to different workloads while maintaining reasonable performance and power consumption levels. When the VPU runs in balanced mode, it can keep the corresponding device balanced between encoding and decoding and power consumption.
[0090] In the three working modes a) to c) above, the working mode of the VPU can be adjusted according to business requirements / scenario, thereby adjusting the operating parameters of the VPU.
[0091] For example Figure 3 As shown, the specific adjustment process may include:
[0092] S1: Based on event triggering, such as creating a video codec instance and needing to improve codec efficiency, execute the instruction to query the VPU working mode to obtain the current working mode of the VPU; this instruction can be issued by the system program;
[0093] S2: Determine whether the VPU working mode needs to be adjusted, and set the VPU to a high-performance mode when adjustment is required; for example, if the current working mode of the VPU is a power-saving mode or a balanced mode, it needs to be adjusted to a high-performance mode;
[0094] S3: In response to the system instruction, query the VPU working mode to detect whether the VPU is adjusted to a high-performance mode.
[0095] Combine the following Figure 4 The adjustment process in the specific embodiment of the present application is described.
[0096] In a specific embodiment of the present application, the device system may include at least a monitoring module and a scheduling module; by monitoring the load of the GPU, VPU, and CPU and whether there is a video codec instance running, the working mode of the GPU / VPU, the OMX queue, and the priority of the color space conversion are automatically adjusted, thereby improving the efficiency of video codec when there is a video codec requirement, and reducing the power consumption of related hardware when there is no video codec requirement. Figure 4 As shown, the specific adjustment process includes:
[0097] S1: The monitoring module tracks the usage of hardware resources in real time by monitoring the instantiation status of the video codec firmware, and feeds back the relevant information to the scheduling module. Specifically, the monitoring module will continuously / loop detect whether the video codec firmware is instantiated; if it is not instantiated, it will repeat the detection; and once the video codec firmware is detected to be instantiated, it will run the load monitoring of the relevant hardware (such as GPU and CPU) and record the current status. Subsequently, the monitoring module will notify the scheduling module of the instantiation (create codec) message or the de-instantiation (destroy codec) message.
[0098] S2: If the scheduling module receives a video codec firmware instantiation message, it may trigger adjustment of the working modes of the GPU and the VPU, that is, adjusting the GPU and the VPU to a high-performance mode.
[0099] In addition, the monitoring module can cyclically monitor / query the GPU load, and perform exponential smoothing filtering on the obtained load value and send it to the scheduling module. The scheduling module compares the load value with the preset threshold. If the load value is greater than the preset threshold, the GPU scheduling priority of the color space conversion is increased, and the GPU adjustment status gpu_state is recorded (Yes if it is enabled and No if it is not enabled); otherwise, if the load value is less than or equal to the preset threshold, no operation is performed.
[0100] The monitoring module can also cyclically monitor / query the CPU load, and perform exponential smoothing filtering on the obtained load value before sending it to the scheduling module. The scheduling module compares the load value with the preset threshold. If the load value is greater than the preset threshold, the number of OMX queues is increased and the OMX thread priority is increased, and the adjustment status omx_state of the OMX queue is recorded (Yes if it is enabled and No if it is not enabled); otherwise, if it is less than or equal to the preset threshold, no operation is performed.
[0101] S3: If the scheduling module receives the video codec firmware de-instantiation message, it can trigger the adjustment of the working mode of the GPU and the VPU, such as adjusting the GPU and the VPU to the energy-saving mode; at the same time, if the adjustment state of the GPU gpu_state is on, that is, gpu_state==Yes, the GPU scheduling priority of the color space conversion is reduced; if the adjustment state of the OMX queue omx_state is on, that is, omx_state==Yes, the number of OMX queues is reduced and the OMX thread priority is reduced.
[0102] In summary, through the cooperation of the monitoring and scheduling modules, the hardware resource allocation can be dynamically adjusted to optimize the video encoding and decoding performance, thereby improving the video encoding and decoding efficiency under high load conditions and reducing power consumption under low load conditions.
[0103] Combine the following FIG. 5A to FIG. 5CDescribe the technical effects that can be achieved by the solution in this application. Figure 5A , Figure 5A This is a schematic diagram of encoding time consumption when the solution in this application is not used. It performs video encoding tests under high GPU and CPU load. The video encoding resolution is 1080x2340, and the average encoding time for a single frame is about 20ms. Figure 5B , Figure 5B This is a schematic diagram of the encoding time after adopting the scheme in this application. It performs video encoding tests under high-load operation of the GPU and CPU. The video encoding resolution is 1080x2340, and the average encoding time for a single frame is about 10ms. It can be seen that the encoding time can be reduced and the video encoding efficiency can be improved by using the scheme in this application.
[0104] For further comparison of the encoding time before and after the scheme in this application, please refer to Figure 5C Based on Figure 5C It can be seen that under high-load operation of the GPU and CPU, by adopting the solution in this application, the encoding efficiency can be effectively improved and the encoding time can be reduced.
[0105] It should be noted that the video codec adjustment method provided in the embodiment of the present application can be executed by a video codec adjustment device, or a control module in the video codec adjustment device for executing the adjustment method. In the embodiment of the present application, the video codec adjustment device provided in the embodiment of the present application is described by taking the video codec adjustment device executing the adjustment method as an example.
[0106] See also Figure 6 , Figure 6 1 is a schematic diagram of a structure of a video codec adjustment device provided in an embodiment of the present application, the device is applied to an electronic device, and the electronic device can run an Android system, etc. Figure 6 As shown, the video codec adjustment device 60 includes:
[0107] A first monitoring module 61, used to monitor the instantiation state of the video codec firmware;
[0108] The execution module 62 is used to execute a first operation according to the instantiation state; wherein the first operation includes at least one of the following: adjusting the operating parameters of the hardware processor, adjusting the encoding and decoding queue, and adjusting the priority of the encoding processing task.
[0109] Optionally, if the instantiation state is to create a video codec instance, the execution module 62 is specifically configured to execute at least one of the following:
[0110] adjusting an operating parameter of the hardware processor to a first operating parameter, wherein the first operating parameter is used to enhance the performance of the hardware processor;
[0111] Increasing the number of the codec queues, and / or increasing the priority of the codec input thread and / or the codec output thread corresponding to the codec queue;
[0112] Raise the priority of the encoding processing task.
[0113] Optionally, the video codec adjustment device 60 further includes:
[0114] A second monitoring module is used to monitor whether the processor load is greater than a preset threshold;
[0115] The execution module 62 is specifically configured to execute the first operation when it is detected that the processor load is greater than a preset threshold.
[0116] Optionally, if the instantiation state is to destroy the video codec instance, the execution module 62 is specifically configured to execute at least one of the following:
[0117] adjusting an operating parameter of the hardware processor to a second operating parameter, wherein the second operating parameter is used to reduce the performance of the hardware processor;
[0118] Reducing the number of the codec queues, and / or lowering the priority of the codec input thread and / or codec output thread corresponding to the codec queue;
[0119] Lowering the priority of the encoding processing task.
[0120] Optionally, the hardware processor includes at least one of the following:
[0121] Graphics processor GPU, video processing unit VPU.
[0122] Optionally, the encoding processing task includes: color space conversion.
[0123] The video codec adjustment device 60 of the embodiment of the present application can achieve the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0124] Optional, such as Figure 7 As shown, the embodiment of the present application also provides an electronic device 70, including a processor 71, a memory 72, and a program or instruction stored in the memory 72 and executable on the processor 71. When the program or instruction is executed by the processor 71, each process of the above-mentioned video codec adjustment method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0125] The present application also provides a computer program product, including computer instructions, which can achieve the above-mentioned Figure 1 The various processes of the embodiment of the video codec adjustment method shown can achieve the same technical effect, and to avoid repetition, they will not be described again here.
[0126] An embodiment of the present application also provides a readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned video codec adjustment method embodiment can be implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0127] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0128] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0129] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0130] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a service classification device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0131] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for adjusting video encoding and decoding, It is characterized in that include: Monitor the instantiation status of the video codec firmware; According to the instantiation state, a first operation is performed; wherein the first operation includes at least one of the following: adjusting operating parameters of a hardware processor, adjusting a codec queue, and adjusting a priority of a coding processing task.
2. The method according to claim 1, It is characterized in that If the instantiation state is to create a video codec instance, the performing of the first operation includes at least one of the following: adjusting an operating parameter of the hardware processor to a first operating parameter, wherein the first operating parameter is used to enhance the performance of the hardware processor; Increasing the number of the codec queues, and / or increasing the priority of the codec input thread and / or the codec output thread corresponding to the codec queue; Raise the priority of the encoding processing task.
3. The method according to claim 2, It is characterized in that Before performing the first operation, the method further includes: Monitor whether the processor load is greater than a preset threshold; The performing of the first operation includes: When it is monitored that the processor load is greater than a preset threshold, the first operation is performed.
4. The method according to claim 1, It is characterized in that If the instantiation state is to destroy the video codec instance, the performing of the first operation includes at least one of the following: adjusting an operating parameter of the hardware processor to a second operating parameter, wherein the second operating parameter is used to reduce the performance of the hardware processor; Reducing the number of the codec queues, and / or lowering the priority of the codec input thread and / or codec output thread corresponding to the codec queue; Lowering the priority of the encoding processing task.
5. The method according to any one of claims 1 to 4, It is characterized in that The hardware processor includes at least one of the following: Graphics processor GPU, video processing unit VPU.
6. The method according to any one of claims 1 to 4, It is characterized in that The encoding processing task includes: color space conversion.
7. A video codec adjustment device, It is characterized in that include: A first monitoring module, used to monitor the instantiation state of the video codec firmware; An execution module is used to perform a first operation according to the instantiation state; wherein the first operation includes at least one of the following: adjusting the operating parameters of the hardware processor, adjusting the encoding and decoding queue, and adjusting the priority of the encoding processing task.
8. An electronic device, It is characterized in that The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method according to any one of claims 1 to 6.
9. A readable storage medium, It is characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, It is characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Cited By
Video stream processing method and device, electronic equipment and storage medium
CN119172599A
Video stream processing method and device, electronic device and storage medium
CN119172599B
DVFS method and device of hardware video decoder
CN120499393A
