WO2023083213A1 - Data decoding method and apparatus, electronic device and readable storage medium - Google Patents

Data decoding method and apparatus, electronic device and readable storage medium Download PDF

Info

Publication number
WO2023083213A1
WO2023083213A1 PCT/CN2022/130860 CN2022130860W WO2023083213A1 WO 2023083213 A1 WO2023083213 A1 WO 2023083213A1 CN 2022130860 W CN2022130860 W CN 2022130860W WO 2023083213 A1 WO2023083213 A1 WO 2023083213A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
decoded
decoding
soft
block
Prior art date
Application number
PCT/CN2022/130860
Other languages
French (fr)
Chinese (zh)
Inventor
林剑森
何民花
Original Assignee
湖南国科微电子股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 湖南国科微电子股份有限公司 filed Critical 湖南国科微电子股份有限公司
Publication of WO2023083213A1 publication Critical patent/WO2023083213A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/44Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation

Definitions

  • the present application relates to the technical field of encoding and decoding, and in particular to a data decoding method, a data decoding device, electronic equipment, and a computer-readable storage medium.
  • PNG Portable Network Graphics
  • LZ77 LZ77-derived algorithm
  • No data loss which means that when the image content is richer, the PNG image requires more space, so it takes longer to decode the image.
  • a hardware decoder dedicated to decoding is usually provided at present, but the speed of data decoding is still relatively slow and takes a long time.
  • the object of the present application is to provide a data decoding method, a data decoding device, an electronic device, and a computer-readable storage medium, so as to increase the data decoding speed and reduce the time required for data decoding.
  • the application provides a data decoding method, including:
  • Decoded data is constructed using the first decoded data and the second decoded data.
  • the acquiring the data to be decoded and dividing the data to be decoded into first data and second data includes:
  • the dividing the data to be decoded into first data and second data includes:
  • the header information in the target header data block matches the second data.
  • the preset ratio is determined according to the hard solution capability and the soft solution capability.
  • the unprocessed part of the data to be decoded is re-divided into third data and fourth data;
  • re-dividing the undecoded part of the data to be decoded into third data and fourth data includes:
  • the soft decoding situation is that the soft decoding capability is insufficient, divide the first unprocessed part corresponding to the first data in the unprocessed part into the third data and the fourth data, and divide the The second unprocessed part corresponding to the second data in the unprocessed part is determined as the fourth data;
  • the first unprocessed part corresponding to the first data in the unprocessed part is determined as the third data, and the unprocessed part in the The second unprocessed part corresponding to the second data is divided into the third data and the fourth data.
  • said using said first decoded data and said second decoded data to form decoded data includes:
  • the present application also provides a data decoding device, including:
  • a division module configured to obtain data to be decoded, and divide the data to be decoded into first data and second data;
  • a soft decoding module configured to perform soft decoding on the first data to obtain first decoded data
  • a hard decoding module configured to send the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data
  • a constituting module configured to construct decoded data by using the first decoded data and the second decoded data.
  • the present application also provides an electronic device, including a memory and a processor, wherein:
  • the memory is used to store computer programs
  • the processor is configured to execute the computer program to implement the above data decoding method.
  • the present application also provides a computer-readable storage medium for storing a computer program, wherein the above-mentioned data decoding method is implemented when the computer program is executed by a processor.
  • the data decoding method provided by the present application is to obtain data to be decoded, and divide the data to be decoded into first data and second data; perform soft decoding on the first data to obtain first decoded data;
  • the second data is sent to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data; the first decoded data and the second decoded data are used to form decoded data.
  • this method adopts a decoding method combining soft decoding and hard decoding in order to improve the speed of data decoding.
  • the processor obtains the data to be decoded, it divides it into two parts, that is, the first data and the second data, and the first data is decoded by the processor through software, that is, soft decoding, to obtain the first decoded data;
  • the second part is sent to the hardware decoder for hard decoding to obtain the second decoded data.
  • the first decoded data and the second decoded data are combined to obtain complete decoded data.
  • Use the soft decoding capability of the processor to further supplement the decoding capability of the hardware decoder, and use the soft decoding and hard decoding parallel decoding methods to perform decoding, which can further increase the data decoding speed and reduce the time required for data decoding.
  • the present application also provides a data decoding device, an electronic device, and a computer-readable storage medium, which also have the above beneficial effects.
  • FIG. 1 is a flow chart of a data decoding method provided in an embodiment of the present application
  • Fig. 2 is a flow chart of data splitting provided by the embodiment of the present application.
  • FIG. 3 is a specific flow chart for determining a segmentation point provided in an embodiment of the present application.
  • FIG. 4 is a flow chart of load balancing provided by an embodiment of the present application.
  • FIG. 5 is a flow chart of a specific data decoding method provided by an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a data decoding device provided in an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 1 is a flow chart of a data decoding method provided in an embodiment of the present application.
  • the method includes:
  • S101 Acquire data to be decoded, and divide the data to be decoded into first data and second data.
  • the data to be decoded refers to data that needs to be decoded by software or hardware, and its specific form is not limited, for example, it may be PNG image data.
  • the specific way of obtaining the data to be decoded is not limited, for example, it may be obtained from a specified storage location, or may be obtained through a network communication signal.
  • the application utilizes both the soft decoding function of the CPU and the hard decoding function of the hardware decoder to decode the data to be decoded. Therefore, after the CPU acquires the data to be decoded, it needs to divide it into two parts, ie, the first data and the second data, which are used for soft decoding and hard decoding respectively.
  • PNG image data and other data to be decoded with data header-intermediate data-tail data format can be inserted by inserting new data header and tail data
  • the data to be decoded is divided into two independent smaller data blocks in a manner to complete the generation of the first data and the second data. Specifically, the following steps may be included:
  • Step 11 Identify the head data block, several file data blocks and tail data blocks in the data to be decoded.
  • Step 12 Determine the split point among several file data blocks according to the preset ratio according to the head-to-tail order.
  • Step 13 Insert the target tail data block at the split point, and insert the target head data block after the target tail data block.
  • Step 14 Determine the head data block, the target tail data block, and the data blocks between the head data block and the target tail data block as the first data, and determine the target head data block, the tail data block, and the data blocks from the target head data block to the end The data blocks between the data blocks are determined as the second data.
  • the header information in the target header data block matches the second data.
  • PNG data the structure of the entire data to be decoded is shown in Table 1:
  • IHDR is a file header data block, or called a header data block
  • IDAT is an image data block, or called a file data block
  • IEND is an image end data, or called a tail data block.
  • Table 2 the structure of the IDAT data block is shown in Table 2:
  • the structure of the IHDR data block is shown in Table 3:
  • the header data block in the data to be decoded records the relevant information of the entire data to be processed, so when the data to be decoded is divided by inserting a new target header data block, the newly inserted target header data block
  • the header information (that is, the information in the above Table 3) needs to match the specific situation of the second data.
  • the split point is selected according to a preset ratio.
  • the preset ratio refers to the ratio of the data to be decoded that is processed by soft decoding and the ratio that is processed by hard decoding, and its specific size is not limited.
  • the file data block is used as the unit, so the final selected split point may not be selected strictly according to the preset ratio, for example, it can be a file selected according to the preset ratio
  • the target tail data block is first inserted. Usually, the content of the tail data block is fixed, and is used to mark the end of the data. For example, for a PNG image, the content of the tail data block is 00 00 00 00 00 49 45 4E 44 AE 42 60 82 12 characters. After the cherub target tail data block, insert the target header data block after it. By inserting new tail data blocks and head data blocks, one piece of data to be decoded can be divided into two independent new data, that is, first data and second data.
  • FIG. 2 is a flow chart of data splitting provided by an embodiment of the present application. If the data to be decoded is PNG data with a file data block size of 10M, it can be split into first data with a size of 2M and second data with a size of 8M through the above method. The result of the division is externally shown as one image is split into two images.
  • FIG. 3 is a specific flow chart for determining a segmentation point provided by an embodiment of the present application.
  • Each IDAT data block includes data block length, data block type code (for PNG data, it is specifically 49 44 41 54), compressed data, and CRC (Cyclic Redundancy Check, cyclic redundancy) for verification checksum) checksum.
  • the specific size of the preset ratio is not limited, and can be formulated as required, for example, it can be designated as 20%.
  • the preset ratio in order to reduce the time required for decoding as much as possible, can be set according to the soft decoding capability and the hard decoding capability, so as to evenly distribute the load for the CPU and the hardware decoder as much as possible. Specifically, the following steps can be performed:
  • Step 21 Determine the hardware decoding capability corresponding to the hardware decoder.
  • Step 22 Determine the soft solution capability under preset conditions.
  • Step 23 Determine the preset ratio according to the hard solution capability and the soft solution capability.
  • the CPU cannot use all computing resources for data decoding, it also needs to use some computing resources for other services. Therefore, when determining the soft decoding capability of the CPU, it is necessary to determine the soft decoding capability of the CPU under preset conditions.
  • the preset conditions refer to the computing resource constraints used by the CPU when decoding data. For example, 50% of the computing resources can be used for the CPU.
  • the condition for data decoding By setting preset conditions, the determined soft solution capability is more in line with the actual decoding situation, making the setting of the preset ratio more accurate.
  • the specific forms of the hard decoding capability and the soft decoding capability are not limited, for example, it may be the amount of data to be decoded that can be processed per unit time.
  • the disassembly of the data to be decoded also takes a certain amount of time.
  • the time required for decoding by using the hardware decoder is relatively short, the division and the soft decoding are used at the same time. It may take longer to decode with the hard solution. Therefore, when dividing the first data and the second data, the following steps can be performed:
  • Step 31 Obtain the data to be decoded, and judge whether the data to be decoded is greater than a preset data volume threshold.
  • Step 32 If it is greater than the preset data volume threshold, divide the data to be decoded into first data and second data.
  • the preset data volume threshold refers to the threshold used to judge whether it is necessary to use a decoding method that combines hard decoding and soft decoding for decoding. If the data amount of the data to be decoded is not greater than the preset data amount threshold, it means that the data to be decoded is relatively small, and the time required for decoding by using a hardware decoder alone is short, so the existing method can be used for decoding. If it is greater than the preset data volume threshold, it means that the data to be decoded is relatively large, and the decoding time required by the combination of soft decoding and hard decoding is relatively short, so it can be divided into the first data and the second data. It should be noted that there may be multiple preset data volume thresholds, and each preset data volume threshold corresponds to the load of the CPU, because the load of the CPU also affects the time required for dividing the data to be decoded.
  • S102 Perform soft decoding on the first data to obtain first decoded data.
  • the CPU After the division of the first data and the second data is completed, the CPU is responsible for performing soft decoding on the first data, and the first decoded data is obtained after decoding. It can be understood that, taking PNG data as an example, when performing soft decoding, the CPU sequentially decodes the compressed data in each IDAT data block. Therefore, the first decoded data includes all data obtained after decoding the first data.
  • S103 Send the second data to the hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data.
  • the hardware decoder is responsible for decoding the second data.
  • the division of data is carried out in the storage location that can be accessed by the CPU, and the hardware decoder usually does not have the ability to actively read the data, so after the second data is divided, the CPU needs to send the second data to the hardware decoding device, so that it decodes the second data to obtain the second decoded data.
  • step S102 and step S103 should be executed in parallel.
  • the load of the CPU and the hardware decoder can also be balanced according to the decoding situation, so as to make full use of the decoding capability as much as possible and reduce the decoding time. Specifically, the following steps can also be performed:
  • Step 41 If it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided into third data and fourth data.
  • Step 42 Perform soft decoding on the third data as new first data, and send the fourth data to the hardware decoder as new second data.
  • the load balancing condition refers to the condition that the load allocated to the CPU and the hardware decoder needs to be redistributed, and its specific content is not limited. For example, a change in the computing resources used by the CPU for soft solution results in a change in the time required for the soft solution, or It means that the variation range of the duration of the change exceeds the preset range. Since the decoding capability of the hardware decoder is usually fixed, the satisfaction of the load balancing condition is usually caused by the change of the soft decoding situation. Therefore, if it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided to obtain the third data and the fourth data.
  • the unprocessed part includes the unprocessed part in the first data and/or the unprocessed part in the second data.
  • the third data is determined as the new first data, which is soft-decoded
  • the fourth data is determined as the new second data, which is hard-decoded.
  • the soft decoding situation reflects the changes of the CPU during the soft decoding process, which may specifically provide the CPU with more computing resources for soft decoding, or provide less computing resources for soft decoding. Therefore, the process of re-dividing the third data and the fourth data may include the following steps:
  • Step 51 If the soft decoding situation is that the soft decoding capability is insufficient, divide the first unprocessed part corresponding to the first data in the unprocessed part into third data and fourth data, and divide the unprocessed part corresponding to the second data The second unprocessed portion is determined as fourth data.
  • Step 52 If the soft decoding situation is that the soft decoding capacity is excessive, determine the first unprocessed part corresponding to the first data in the unprocessed part as the third data, and determine the second unprocessed part corresponding to the second data in the unprocessed part The part is divided into third data and fourth data.
  • the soft decoding is that the soft decoding capability is insufficient, it means that the CPU cannot complete the decoding of all the first data on time according to the pre-plan. Therefore, the first unprocessed part corresponding to the first data in the unprocessed part is divided into third data and fourth data, that is, part of the load originally responsible by the CPU is redistributed to the hardware decoder for processing, and the unprocessed part The second unprocessed part corresponding to the second data is determined as the fourth data.
  • the soft decoding situation is that the soft decoding capacity is excessive, it means that the CPU provides more computing resources than planned for decoding.
  • the second unprocessed part corresponding to the second data in the unprocessed part is divided into third data and fourth data, that is, part of the load originally responsible for the hardware decoder is redistributed to the CPU for processing, and the unprocessed part is divided into the third data and the fourth data.
  • the first unprocessed part corresponding to the first data in the processed part is determined as the third data.
  • FIG. 4 is a flow chart of load balancing provided by an embodiment of the present application. It can be seen that the originally divided first data is 1M, and the second data is 9M. During the decoding process, it was found that the CPU provided more computing resources than expected for soft decoding, and its soft decoding capacity was excessive. In this case, since the hardware decoder decodes the second data in head-to-tail order, the unprocessed second unprocessed part can be selected from the tail of the original 9M, and the 1M size can be divided as the third part data, and determine the remaining second unprocessed part as fourth data.
  • S104 Use the first decoded data and the second decoded data to form decoded data.
  • the first decoded data and the second decoded data After the first decoded data and the second decoded data are obtained, they can be used to form completed decoded data corresponding to the data to be decoded. It can be understood that by dividing the data to be decoded into two parts and performing soft decoding and hard decoding respectively, more data can be decoded per unit time, making the speed of data decoding faster.
  • the hard solution and the soft solution may not be completed at the same time, and only when all the first decoded data and the second decoded data are obtained can they be used to form complete decoded data. Therefore, the process of forming decoded data may include the following steps:
  • Step 61 Based on the position of the first data in the data to be decoded, write the first decoded data into the first position of the memory space.
  • Step 62 If it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded, then it is determined that the decoded data is constructed.
  • the hardware decoder can directly write to the memory space, so there is no need for the CPU to obtain the second decoded data.
  • the writing position of the first decoded data and the second decoded data is related to whether the complete decoded data obtained after decoding is correct or not, when writing, it needs to be based on the decoded
  • the position of the first data or the second data in the data to be decoded writes the decoded data into the memory space.
  • the CPU monitors the writing of the second decoded data, and after detecting that all the second decoded data is written into the memory space, it can determine that all the decoded data is completed, and then determine that the decoded data is formed.
  • FIG. 5 is a flowchart of a specific data decoding method provided by an embodiment of the present application, which is specifically used for decoding a picture file.
  • the image file is read or obtained through the network, it is judged whether its type is the type that needs to be decoded, and if not, it is processed in a conventional manner. If decoding is required, the size and type of the image are obtained for subsequent determination of the decoding method.
  • the hardware decoder that is, the decoding module capability
  • the CPU will decompose and subpackage the picture file, send the second data to the hardware decoder, and record the distribution of the data packets of the soft solution and the hard solution at the same time, so as to perform balance monitoring.
  • Load balancing conditions recalculate the current data volume and redistribute it, so as to ensure the balance of soft solution and hard solution, and try to make the two complete at the same time.
  • the data content output in the two decoding modes is integrated and sent to the terminal or other decoded data demanders.
  • a decoding method combining soft decoding and hard decoding is adopted.
  • the processor obtains the data to be decoded, it divides it into two parts, that is, the first data and the second data, and the first data is decoded by the processor through software, that is, soft decoding, to obtain the first decoded data;
  • the second part is sent to the hardware decoder for hard decoding to obtain the second decoded data.
  • the first decoded data and the second decoded data are combined to obtain complete decoded data.
  • Use the soft decoding capability of the processor to further supplement the decoding capability of the hardware decoder, and use the soft decoding and hard decoding parallel decoding methods to perform decoding, which can further increase the data decoding speed and reduce the time required for data decoding.
  • the data decoding device provided by the embodiment of the present application is introduced below, and the data decoding device described below and the data decoding method described above may be referred to in correspondence.
  • FIG. 6 is a schematic structural diagram of a data decoding device provided in an embodiment of the present application, including:
  • a dividing module 110 configured to acquire data to be decoded, and divide the data to be decoded into first data and second data;
  • the soft decoding module 120 is configured to perform soft decoding on the first data to obtain the first decoded data
  • the hard decoding module 130 is configured to send the second data to the hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
  • a forming module 140 configured to use the first decoded data and the second decoded data to form decoded data.
  • the division module 110 includes:
  • a size judging unit configured to acquire data to be decoded, and judge whether the data to be decoded is greater than a preset data volume threshold
  • the division unit is configured to divide the data to be decoded into first data and second data if it is greater than a preset data volume threshold.
  • partition module 110 comprising:
  • a data block identification unit configured to identify a header data block, several file data blocks and tail data blocks in the data to be decoded
  • a split point determining unit configured to determine a split point among several file data blocks according to a preset ratio according to the head-to-tail sequence
  • a data block insertion unit is used to insert the target tail data block at the split point, and insert the target head data block after the target tail data block;
  • the split determination unit is used to determine the header data block, the target tail data block, and the data blocks between the header data block and the target tail data block as the first data, and determine the target header data block, the tail data block, and the data blocks from the target header The data block between the data block and the tail data block is determined as the second data;
  • the header information in the target header data block matches the second data.
  • the hard solution capability determination module is used to determine the hard solution capability corresponding to the hardware decoder
  • a soft solution capability determination module is used to determine the soft solution capability under preset conditions
  • the ratio determination module is used to determine the preset ratio according to the hard solution capability and the soft solution capability.
  • a re-division module configured to re-divide the unprocessed part of the data to be decoded into third data and fourth data according to the soft decoding situation if it is detected that the load balancing condition is met;
  • the decoding processing module is configured to perform soft decoding on the third data as new first data, and send the fourth data to the hardware decoder as new second data.
  • repartition the modules including:
  • the first division unit is used to divide the first unprocessed part corresponding to the first data in the unprocessed part into third data and fourth data if the soft decoding situation is that the soft decoding capability is insufficient, and divide the unprocessed part into the third data and the fourth data.
  • the second unprocessed part corresponding to the second data is determined as the fourth data;
  • the second division unit is used to determine the first unprocessed part corresponding to the first data in the unprocessed part as the third data if the soft decoding situation is that the soft decoding capability is excessive, and determine the corresponding part of the second data in the unprocessed part
  • the second unprocessed portion is divided into third data and fourth data.
  • constitute module 140 including:
  • a writing unit configured to write the first decoded data into the first position of the memory space based on the position of the first data in the data to be decoded;
  • the configuration determination unit is configured to determine that the configuration of the decoded data is completed if it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded.
  • the electronic device provided by the embodiment of the present application is introduced below, and the electronic device described below and the data decoding method described above may be referred to in correspondence.
  • the electronic device 100 may include a processor 101 and a memory 102 , and may further include one or more of a multimedia component 103 , an information input/information output (I/O) interface 104 and a communication component 105 .
  • a multimedia component 103 may be included in the electronic device 100 .
  • I/O information input/information output
  • the processor 101 is used to control the overall operation of the electronic device 100 to complete all or part of the steps in the above data decoding method;
  • the memory 102 is used to store various types of data to support the operation of the electronic device 100, these data For example, instructions for any application or method operating on the electronic device 100 may be included, as well as application-related data.
  • the memory 102 can be realized by any type of volatile or non-volatile storage device or their combination, such as Static Random Access Memory (Static Random Access Memory, SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (Read-Only Memory, One or more of Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
  • Static Random Access Memory Static Random Access Memory
  • SRAM Static Random Access Memory
  • EEPROM Electrically Erasable Programmable Read-Only Memory
  • EPROM Erasable Programmable Read-Only Memory
  • PROM Programmable Read-Only Memory
  • Read-Only Memory One or more of Only Memory, ROM
  • magnetic memory flash memory
  • flash memory magnetic disk or optical disk.
  • Multimedia components 103 may include screen and audio components.
  • the screen can be, for example, a touch screen, and the audio component is used for outputting and/or inputting audio signals.
  • an audio component may include a microphone for receiving external audio signals.
  • the received audio signal may be further stored in the memory 102 or sent via the communication component 105 .
  • the audio component also includes at least one speaker for outputting audio signals.
  • I/O interface 104 provides interface between processor 101 and other interface modules, and above-mentioned other interface modules can be keyboard, mouse, button etc. These buttons can be virtual buttons or physical buttons.
  • the communication component 105 is used for wired or wireless communication between the electronic device 100 and other devices.
  • Wireless communication such as Wi-Fi, Bluetooth, near field communication (Near Field Communication, NFC for short), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 105 may include: Wi-Fi parts, Bluetooth parts, NFC parts.
  • the electronic device 100 may be implemented by one or more Application Specific Integrated Circuit (ASIC for short), Digital Signal Processor (DSP for short), Digital Signal Processing Device (DSPD for short), Programmable Logic Device (Programmable Logic Device, PLD for short), Field Programmable Gate Array (Field Programmable Gate Array, FPGA for short), controller, microcontroller, microprocessor or other electronic components are implemented for implementing the above embodiments The given data decoding method.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Processor
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • Field Programmable Gate Array Field Programmable Gate Array
  • FPGA Field Programmable Gate Array
  • the computer-readable storage medium provided by the embodiments of the present application is introduced below, and the computer-readable storage medium described below and the data decoding method described above may be referred to in correspondence.
  • the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned data decoding method are implemented.
  • the computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc., which can store program codes. medium.
  • each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other.
  • the description is relatively simple, and for relevant details, please refer to the description of the method part.
  • RAM random access memory
  • ROM read-only memory
  • EEPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • registers hard disk, removable disk, CD-ROM, or any other Any other known storage medium.

Abstract

A data decoding method and apparatus, an electronic device and a computer-readable storage medium, the method comprising: acquiring data to be decoded, and dividing the data to be decoded into first data and second data; performing soft decoding on the first data to obtain first decoded data; sending the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data; using the first decoded data and the second decoded data to form decoded data; and further supplementing the decoding capability of the hardware decoder by using the soft decoding capability of a processor, and carrying out decoding by using a decoding means parallel to soft decoding and hard decoding, so that the data decoding speed may be further improved, and the duration required for data decoding is reduced.

Description

一种数据解码方法、装置、电子设备及可读存储介质A data decoding method, device, electronic equipment and readable storage medium
本申请要求于2021年11月10日提交中国专利局、申请号为202111326932.1、发明名称为“一种数据解码方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application submitted to the China Patent Office on November 10, 2021, with the application number 202111326932.1, and the title of the invention is "a data decoding method, device, electronic device, and readable storage medium", all of which The contents are incorporated by reference in this application.
技术领域technical field
本申请涉及编解码技术领域,特别涉及一种数据解码方法、数据解码装置、电子设备及计算机可读存储介质。The present application relates to the technical field of encoding and decoding, and in particular to a data decoding method, a data decoding device, electronic equipment, and a computer-readable storage medium.
背景技术Background technique
对于图像数据等编码数据来说,在读取其中内容时需要进行解码,例如便携式网络图片(Portable Network Graphics,PNG),其是目前最流行的图片格式,运用于各个常见领域。PNG图片采取完全无损的LZ77派生算法对图片进行压缩。不损失数据,这就意味着,在图片内容更丰富的情况下,PNG图片所需要的空间更大,从而在图片解码的过程中,需要的时间更长。为了提高数据解码速度,当前通常会设置专门用于解码的硬件解码器,但是数据解码的速度仍然较慢,所需的时间较长。For encoded data such as image data, it needs to be decoded when reading its content, such as Portable Network Graphics (PNG), which is currently the most popular image format and is used in various common fields. PNG images are compressed using a completely lossless LZ77-derived algorithm. No data loss, which means that when the image content is richer, the PNG image requires more space, so it takes longer to decode the image. In order to increase the speed of data decoding, a hardware decoder dedicated to decoding is usually provided at present, but the speed of data decoding is still relatively slow and takes a long time.
发明内容Contents of the invention
有鉴于此,本申请的目的在于提供一种数据解码方法、数据解码装置、电子设备及计算机可读存储介质,提高数据解码速度,减少数据解码所需的时长。In view of this, the object of the present application is to provide a data decoding method, a data decoding device, an electronic device, and a computer-readable storage medium, so as to increase the data decoding speed and reduce the time required for data decoding.
为解决上述技术问题,本申请提供了一种数据解码方法,包括:In order to solve the above technical problems, the application provides a data decoding method, including:
获取待解码数据,并将所述待解码数据划分为第一数据和第二数据;acquiring data to be decoded, and dividing the data to be decoded into first data and second data;
对所述第一数据进行软解码,得到第一解码数据;performing soft decoding on the first data to obtain first decoded data;
将所述第二数据发送至硬件解码器,以便所述硬件解码器对所述第二数据进行解码得到第二解码数据;sending the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
利用所述第一解码数据和所述第二解码数据构成解码数据。Decoded data is constructed using the first decoded data and the second decoded data.
可选地,所述获取待解码数据,并将所述待解码数据划分为第一数据和第二数据,包括:Optionally, the acquiring the data to be decoded and dividing the data to be decoded into first data and second data includes:
获取所述待解码数据,并判断所述待解码数据是否大于预设数据量阈值;Acquiring the data to be decoded, and judging whether the data to be decoded is greater than a preset data volume threshold;
若大于所述预设数据量阈值,则将所述待解码数据划分为所述第一数据和所述第二数据。If it is greater than the preset data volume threshold, divide the data to be decoded into the first data and the second data.
可选地,所述将所述待解码数据划分为第一数据和第二数据,包括:Optionally, the dividing the data to be decoded into first data and second data includes:
识别所述待解码数据中的头数据块、若干个文件数据块和尾数据块;identifying the header data block, several file data blocks and tail data blocks in the data to be decoded;
按照头尾顺序,按照预设比例在所述若干个文件数据块之间确定分割点;Determining split points among the plurality of file data blocks according to a preset ratio according to the head-to-tail order;
在所述分割点处插入目标尾数据块,并在所述目标尾数据块后插入目标头数据块;Inserting a target tail data block at the split point, and inserting a target head data block after the target tail data block;
将所述头数据块、所述目标尾数据块以及所述头数据块至所述目标尾数据块之间的数据块确定为所述第一数据,并将所述目标头数据块、所述尾数据块以及从所述目标头数据块至所述尾数据块之间的数据块确定为所述第二数据;determining the head data block, the target tail data block, and data blocks between the head data block and the target tail data block as the first data, and setting the target head data block, the The tail data block and the data blocks between the target head data block and the tail data block are determined as the second data;
其中,所述目标头数据块中的头信息与所述第二数据相匹配。Wherein, the header information in the target header data block matches the second data.
可选地,还包括:Optionally, also include:
确定所述硬件解码器对应的硬解能力;determining the hardware decoding capability corresponding to the hardware decoder;
确定在预设条件下的软解能力;Determine the soft solution capability under preset conditions;
根据所述硬解能力和所述软解能力确定所述预设比例。The preset ratio is determined according to the hard solution capability and the soft solution capability.
可选地,还包括:Optionally, also include:
若检测到满足负载平衡条件,则根据软解码情况,将所述待解码数据中的未处理部分重新划分为第三数据和第四数据;If it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided into third data and fourth data;
将所述第三数据作为新第一数据进行软解码,并将所述第四数据作为新第二数据发送至硬件解码器。performing soft decoding on the third data as new first data, and sending the fourth data to a hardware decoder as new second data.
可选地,所述根据软解码情况,将所述待解码数据中未经解码的部分重新划分为第三数据和第四数据,包括:Optionally, according to the soft decoding situation, re-dividing the undecoded part of the data to be decoded into third data and fourth data includes:
若所述软解码情况为软解能力不足,则将所述未处理部分中所述第一 数据对应的第一未处理部分划分为所述第三数据和所述第四数据,并将所述未处理部分中所述第二数据对应的第二未处理部分确定为所述第四数据;If the soft decoding situation is that the soft decoding capability is insufficient, divide the first unprocessed part corresponding to the first data in the unprocessed part into the third data and the fourth data, and divide the The second unprocessed part corresponding to the second data in the unprocessed part is determined as the fourth data;
若所述软解码情况为软解能力过剩,则将所述未处理部分中所述第一数据对应的第一未处理部分确定为所述第三数据,并将所述未处理部分中所述第二数据对应的第二未处理部分划分为所述第三数据和所述第四数据。If the soft decoding situation is that the soft decoding capability is excessive, the first unprocessed part corresponding to the first data in the unprocessed part is determined as the third data, and the unprocessed part in the The second unprocessed part corresponding to the second data is divided into the third data and the fourth data.
可选地,所述利用所述第一解码数据和所述第二解码数据构成解码数据,包括:Optionally, said using said first decoded data and said second decoded data to form decoded data includes:
基于所述第一数据在所述待解码数据中的位置,将所述第一解码数据写入内存空间的第一位置;writing the first decoded data into a first position in memory space based on the position of the first data in the data to be decoded;
若检测到所有的所述第二解码数据,均基于所述第二数据在所述待解码数据中的位置,写入到所述内存空间的第二位置,则确定所述解码数据构成完毕。If it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded, it is determined that the decoded data is formed.
本申请还提供了一种数据解码装置,包括:The present application also provides a data decoding device, including:
划分模块,用于获取待解码数据,并将所述待解码数据划分为第一数据和第二数据;A division module, configured to obtain data to be decoded, and divide the data to be decoded into first data and second data;
软解模块,用于对所述第一数据进行软解码,得到第一解码数据;A soft decoding module, configured to perform soft decoding on the first data to obtain first decoded data;
硬解模块,用于将所述第二数据发送至硬件解码器,以便所述硬件解码器对所述第二数据进行解码得到第二解码数据;a hard decoding module, configured to send the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
构成模块,用于利用所述第一解码数据和所述第二解码数据构成解码数据。A constituting module, configured to construct decoded data by using the first decoded data and the second decoded data.
本申请还提供了一种电子设备,包括存储器和处理器,其中:The present application also provides an electronic device, including a memory and a processor, wherein:
所述存储器,用于保存计算机程序;The memory is used to store computer programs;
所述处理器,用于执行所述计算机程序,以实现上述的数据解码方法。The processor is configured to execute the computer program to implement the above data decoding method.
本申请还提供了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现上述的数据解码方法。The present application also provides a computer-readable storage medium for storing a computer program, wherein the above-mentioned data decoding method is implemented when the computer program is executed by a processor.
本申请提供的数据解码方法,获取待解码数据,并将所述待解码数据 划分为第一数据和第二数据;对所述第一数据进行软解码,得到第一解码数据;将所述第二数据发送至硬件解码器,以便所述硬件解码器对所述第二数据进行解码得到第二解码数据;利用所述第一解码数据和所述第二解码数据构成解码数据。The data decoding method provided by the present application is to obtain data to be decoded, and divide the data to be decoded into first data and second data; perform soft decoding on the first data to obtain first decoded data; The second data is sent to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data; the first decoded data and the second decoded data are used to form decoded data.
可见,该方法在进行数据解码时,为了提高数据解码速度,采用了软解和硬解结合的解码方式。具体的,处理器在获取到待解码数据后,将其划分两个部分,即第一数据和第二数据,第一数据由处理器进行软件解码,即软解码,得到第一解码数据;第二部分发送至硬件解码器进行硬解码,得到第二解码数据。在解码完毕后将第一解码数据和第二解码数据相组合,即可得到完整的解码数据。利用处理器的软解码能力对硬件解码器的解码能力进行进一步补充,利用软解和硬解并行的解码方式进行解码,可以进一步提高数据解码速度,减少数据解码所需的时长。It can be seen that when decoding data, this method adopts a decoding method combining soft decoding and hard decoding in order to improve the speed of data decoding. Specifically, after the processor obtains the data to be decoded, it divides it into two parts, that is, the first data and the second data, and the first data is decoded by the processor through software, that is, soft decoding, to obtain the first decoded data; The second part is sent to the hardware decoder for hard decoding to obtain the second decoded data. After the decoding is completed, the first decoded data and the second decoded data are combined to obtain complete decoded data. Use the soft decoding capability of the processor to further supplement the decoding capability of the hardware decoder, and use the soft decoding and hard decoding parallel decoding methods to perform decoding, which can further increase the data decoding speed and reduce the time required for data decoding.
此外,本申请还提供了一种数据解码装置、电子设备及计算机可读存储介质,同样具有上述有益效果。In addition, the present application also provides a data decoding device, an electronic device, and a computer-readable storage medium, which also have the above beneficial effects.
附图说明Description of drawings
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or related technologies. Obviously, the accompanying drawings in the following description are only For the embodiments of the application, those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本申请实施例提供的一种数据解码方法流程图;FIG. 1 is a flow chart of a data decoding method provided in an embodiment of the present application;
图2为本申请实施例提供的一种数据拆分流程图;Fig. 2 is a flow chart of data splitting provided by the embodiment of the present application;
图3为本申请实施例提供的一种具体的分割点确定流程图;FIG. 3 is a specific flow chart for determining a segmentation point provided in an embodiment of the present application;
图4为本申请实施例提供的一种负载平衡流程图;FIG. 4 is a flow chart of load balancing provided by an embodiment of the present application;
图5为本申请实施例提供的一种具体的数据解码方法流程图;FIG. 5 is a flow chart of a specific data decoding method provided by an embodiment of the present application;
图6为本申请实施例提供的一种数据解码装置的结构示意图;FIG. 6 is a schematic structural diagram of a data decoding device provided in an embodiment of the present application;
图7为本申请实施例提供的一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments It is only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
请参考图1,图1为本申请实施例提供的一种数据解码方法流程图。该方法包括:Please refer to FIG. 1 , which is a flow chart of a data decoding method provided in an embodiment of the present application. The method includes:
S101:获取待解码数据,并将待解码数据划分为第一数据和第二数据。S101: Acquire data to be decoded, and divide the data to be decoded into first data and second data.
待解码数据,是指需要被进行软件解码或硬件解码的数据,其具体形式不做限定,例如可以为PNG图像数据。待解码数据的具体获取方式不做限定,例如可以从指定的存储位置获取,或者可以通过网络通信信号获取。为了提高对待解码数据的解码速度,本申请同时利用CPU的软解功能和硬件解码器的硬解功能对待解码数据进行解码。因此CPU在获取到待解码数据后,需要将其划分为两个部分,即第一数据和第二数据,分别用于进行软解码和硬解码。本实施例并不限定划分的具体方式,在一种可行的实施方式中,例如PNG图像数据等具有数据头-中间数据-尾数据格式的待解码数据,可以通过插入新的数据头和尾数据的方式将待解码数据划分为两个独立的更小的数据块,完成第一数据和第二数据的生成。具体的,可以包括如下步骤:The data to be decoded refers to data that needs to be decoded by software or hardware, and its specific form is not limited, for example, it may be PNG image data. The specific way of obtaining the data to be decoded is not limited, for example, it may be obtained from a specified storage location, or may be obtained through a network communication signal. In order to improve the decoding speed of the data to be decoded, the application utilizes both the soft decoding function of the CPU and the hard decoding function of the hardware decoder to decode the data to be decoded. Therefore, after the CPU acquires the data to be decoded, it needs to divide it into two parts, ie, the first data and the second data, which are used for soft decoding and hard decoding respectively. This embodiment does not limit the specific method of division. In a feasible implementation, for example, PNG image data and other data to be decoded with data header-intermediate data-tail data format can be inserted by inserting new data header and tail data The data to be decoded is divided into two independent smaller data blocks in a manner to complete the generation of the first data and the second data. Specifically, the following steps may be included:
步骤11:识别待解码数据中的头数据块、若干个文件数据块和尾数据块。Step 11: Identify the head data block, several file data blocks and tail data blocks in the data to be decoded.
步骤12:按照头尾顺序,按照预设比例在若干个文件数据块之间确定分割点。Step 12: Determine the split point among several file data blocks according to the preset ratio according to the head-to-tail order.
步骤13:在分割点处插入目标尾数据块,并在目标尾数据块后插入目标头数据块。Step 13: Insert the target tail data block at the split point, and insert the target head data block after the target tail data block.
步骤14:将头数据块、目标尾数据块以及头数据块至目标尾数据块之间的数据块确定为第一数据,并将目标头数据块、尾数据块以及从目标头数据块至尾数据块之间的数据块确定为第二数据。Step 14: Determine the head data block, the target tail data block, and the data blocks between the head data block and the target tail data block as the first data, and determine the target head data block, the tail data block, and the data blocks from the target head data block to the end The data blocks between the data blocks are determined as the second data.
其中,目标头数据块中的头信息与第二数据相匹配。以PNG数据为例,整个待解码数据的结构如表1所示:Wherein, the header information in the target header data block matches the second data. Taking PNG data as an example, the structure of the entire data to be decoded is shown in Table 1:
表1 PNG关键数据块Table 1 PNG key data block
Figure PCTCN2022130860-appb-000001
Figure PCTCN2022130860-appb-000001
其中,IHDR为文件头数据块,或称为头数据块,IDAT为图像数据块,或称为文件数据块,IEND为图像结束数据,或称为尾数据块。其中,IDAT数据块的结构如表2所示:Among them, IHDR is a file header data block, or called a header data block, IDAT is an image data block, or called a file data block, and IEND is an image end data, or called a tail data block. Among them, the structure of the IDAT data block is shown in Table 2:
表2 IDAT数据块的组成Table 2 Composition of IDAT data block
Figure PCTCN2022130860-appb-000002
Figure PCTCN2022130860-appb-000002
Figure PCTCN2022130860-appb-000003
Figure PCTCN2022130860-appb-000003
IHDR数据块的结构如表3所示:The structure of the IHDR data block is shown in Table 3:
表3 PNG头文件信息Table 3 PNG header file information
Figure PCTCN2022130860-appb-000004
Figure PCTCN2022130860-appb-000004
Figure PCTCN2022130860-appb-000005
Figure PCTCN2022130860-appb-000005
由此可见,待解码数据中的头数据块中记载有整个待处理数据的相关信息,因此在通过插入新的目标头数据块进行待解码数据的划分时,新插入的目标头数据块中的头信息(即上述表3中的信息)需要与第二数据的具体情况相匹配。It can be seen that the header data block in the data to be decoded records the relevant information of the entire data to be processed, so when the data to be decoded is divided by inserting a new target header data block, the newly inserted target header data block The header information (that is, the information in the above Table 3) needs to match the specific situation of the second data.
在进行第一数据和第二数据的划分时,首先识别其中的头数据块(即IHDR)、若干个文件数据块(即IDAT)以及对应的尾数据块(即IEND)。由于文件数据块中的数据与图像的显示相关,因此在划分时,通常采用连续划分的方式,即只对文件数据块划分一次。在本实施方式中,具体按照从头到尾的顺序,从第一个文件数据块开始,按照预设比例选取分割点。预设比例是指待解码数据中被软解处理的比例和被硬解处理的比例,其具体大小不做限定。可以理解的是,在进行分割点选择时,是以文件数据块为单位进行的,因此最终选择的分割点可能并不是严格按照预设比例选取的位置,例如可以为按照预设比例选取的文件数据块的数据块结尾位置或数据块开始位置。在确定分割点后,首先插入目标尾数据块。通常情况下,尾数据块的内容是固定的,用于起到标识数据结束的作用。例如对于PNG图像来说,其尾数据块的内容为00 00 00 00 49 45 4E 44 AE 42 60 82 12的字符。在cherub目标尾数据块后,在其后再插入目标头数据块。通过插入新的尾数据块和头数据块,可以将一个待解码数据划分为两个独立的新数据,即第一数据和第二数据。When dividing the first data and the second data, first identify the header data block (ie IHDR), several file data blocks (ie IDAT) and the corresponding tail data block (ie IEND). Since the data in the file data block is related to the display of the image, when dividing, the method of continuous division is usually adopted, that is, the file data block is only divided once. In this embodiment, specifically, in order from the beginning to the end, starting from the first file data block, the split point is selected according to a preset ratio. The preset ratio refers to the ratio of the data to be decoded that is processed by soft decoding and the ratio that is processed by hard decoding, and its specific size is not limited. It can be understood that when selecting the split point, the file data block is used as the unit, so the final selected split point may not be selected strictly according to the preset ratio, for example, it can be a file selected according to the preset ratio The end-of-block position or the start-of-block position of the data block. After the split point is determined, the target tail data block is first inserted. Usually, the content of the tail data block is fixed, and is used to mark the end of the data. For example, for a PNG image, the content of the tail data block is 00 00 00 00 49 45 4E 44 AE 42 60 82 12 characters. After the cherub target tail data block, insert the target header data block after it. By inserting new tail data blocks and head data blocks, one piece of data to be decoded can be divided into two independent new data, that is, first data and second data.
请参考图2,图2为本申请实施例提供的一种数据拆分流程图。若待解码数据为文件数据块大小为10M的PNG数据,通过上述方式,则可以将其拆分为大小为2M的第一数据和大小为8M的第二数据。划分结果对外表现为,一张图像被拆分为两张图像。请参考图3,图3为本申请实施例提供的一种具体的分割点确定流程图。每个IDAT数据块中包括数据块长度、数据块类型码(对于PNG数据来说,其具体为49 44 41 54)、被压缩的数据以及用于校验的CRC(Cyclic Redundancy Check,循环冗余校验)校验码。在进行划分时,可以从第一个IDAT数据块开始,按照头尾顺序依次选择IDAT数据块,并累加各个选中的IDAT数据块的数据块长度,当 检测到数据块长度的累加值与整个需要分割的数据相比的比例与预设比例相匹配,则将被累加的数据块与未被累加的数据块之间的位置确定为分割点。Please refer to FIG. 2 . FIG. 2 is a flow chart of data splitting provided by an embodiment of the present application. If the data to be decoded is PNG data with a file data block size of 10M, it can be split into first data with a size of 2M and second data with a size of 8M through the above method. The result of the division is externally shown as one image is split into two images. Please refer to FIG. 3 . FIG. 3 is a specific flow chart for determining a segmentation point provided by an embodiment of the present application. Each IDAT data block includes data block length, data block type code (for PNG data, it is specifically 49 44 41 54), compressed data, and CRC (Cyclic Redundancy Check, cyclic redundancy) for verification checksum) checksum. When dividing, you can start from the first IDAT data block, select the IDAT data blocks sequentially according to the order of the head and the tail, and accumulate the data block lengths of each selected IDAT data block. When the accumulated value of the data block length is detected. If the proportion of the divided data matches the preset proportion, the position between the accumulated data block and the unaccumulated data block is determined as the division point.
需要说明的是,预设比例的具体大小不做限定,可以根据需要进行制定,例如可以指定为20%。在另一种实施方式中,为了尽可能的减少解码所需的时长,可以根据软解能力和硬解能力对预设比例进行设置,以便尽可能地为CPU和硬件解码器平均分配负载。具体的,可以执行如下步骤:It should be noted that the specific size of the preset ratio is not limited, and can be formulated as required, for example, it can be designated as 20%. In another embodiment, in order to reduce the time required for decoding as much as possible, the preset ratio can be set according to the soft decoding capability and the hard decoding capability, so as to evenly distribute the load for the CPU and the hardware decoder as much as possible. Specifically, the following steps can be performed:
步骤21:确定硬件解码器对应的硬解能力。Step 21: Determine the hardware decoding capability corresponding to the hardware decoder.
步骤22:确定在预设条件下的软解能力。Step 22: Determine the soft solution capability under preset conditions.
步骤23:根据硬解能力和软解能力确定预设比例。Step 23: Determine the preset ratio according to the hard solution capability and the soft solution capability.
由于CPU并不能够利用全部计算资源进行数据解码,其还需要使用部分计算资源进行其他业务。因此在确定CPU的软解能力时,需要确定CPU在预设条件的软解能力,预设条件,是指CPU进行数据解码时采用的计算资源限制条件,例如可以为CPU采用50%的计算资源进行数据解码这一条件。通过设置预设条件,确定到的软解能力更加符合实际解码时的情况,使得预设比例的设置更加准确。硬解能力和软解能力的具体形式不做限定,例如可以为单位时间内可以处理的待解码数据量。在确定软解能力和硬解能力后,可以根据二者的大小比例确定预设比例,例如当P 硬解=4P 软解时,则可以将预设比例确定为20%。 Since the CPU cannot use all computing resources for data decoding, it also needs to use some computing resources for other services. Therefore, when determining the soft decoding capability of the CPU, it is necessary to determine the soft decoding capability of the CPU under preset conditions. The preset conditions refer to the computing resource constraints used by the CPU when decoding data. For example, 50% of the computing resources can be used for the CPU. The condition for data decoding. By setting preset conditions, the determined soft solution capability is more in line with the actual decoding situation, making the setting of the preset ratio more accurate. The specific forms of the hard decoding capability and the soft decoding capability are not limited, for example, it may be the amount of data to be decoded that can be processed per unit time. After the soft solution capability and the hard solution capability are determined, the preset ratio can be determined according to the size ratio of the two. For example, when Phard solution =4Psoft solution , the preset ratio can be determined as 20%.
在另一种实施方式中,可以理解的是,对待解码数据的拆解同样需要消耗一定时间,在原本利用硬件解码器进行解码所需的时间较短的情况下,采用划分后同时利用软解和硬解的方式进行解码所需的时间可能更长。因此,在划分第一数据和第二数据时,可以执行如下步骤:In another embodiment, it can be understood that the disassembly of the data to be decoded also takes a certain amount of time. In the case that the time required for decoding by using the hardware decoder is relatively short, the division and the soft decoding are used at the same time. It may take longer to decode with the hard solution. Therefore, when dividing the first data and the second data, the following steps can be performed:
步骤31:获取待解码数据,并判断待解码数据是否大于预设数据量阈值。Step 31: Obtain the data to be decoded, and judge whether the data to be decoded is greater than a preset data volume threshold.
步骤32:若大于预设数据量阈值,则将待解码数据划分为第一数据和第二数据。Step 32: If it is greater than the preset data volume threshold, divide the data to be decoded into first data and second data.
预设数据量阈值,是指用于判断是否需要采用硬解和软解想配合的解码方式进行解码的阈值。若待解码数据的数据量不大于预设数据量阈值, 则说明待解码数据较小,采用硬件解码器单独进行解码所需的时间较短,因此可以采用现有方式进行解码。若大于预设数据量阈值,则说明待解码数据较大,采用软解和硬解配合的解码方式所需的时间较短,因此可以将其划分为第一数据和第二数据。需要说明的是,预设数据量阈值可以存在多个,每个预设数据量阈值分别与CPU的负载情况相对应,因为CPU的负载情况同样会影响待解码数据划分所需的时长。The preset data volume threshold refers to the threshold used to judge whether it is necessary to use a decoding method that combines hard decoding and soft decoding for decoding. If the data amount of the data to be decoded is not greater than the preset data amount threshold, it means that the data to be decoded is relatively small, and the time required for decoding by using a hardware decoder alone is short, so the existing method can be used for decoding. If it is greater than the preset data volume threshold, it means that the data to be decoded is relatively large, and the decoding time required by the combination of soft decoding and hard decoding is relatively short, so it can be divided into the first data and the second data. It should be noted that there may be multiple preset data volume thresholds, and each preset data volume threshold corresponds to the load of the CPU, because the load of the CPU also affects the time required for dividing the data to be decoded.
S102:对第一数据进行软解码,得到第一解码数据。S102: Perform soft decoding on the first data to obtain first decoded data.
在第一数据和第二数据划分完毕后,CPU负责对第一数据进行软解码,解码后得到第一解码数据。可以理解的是,以PNG数据为例,在进行软解码时,CPU依次对各个IDAT数据块中被压缩的数据进行解码。因此第一解码数据包括所有第一数据解码后得到的数据。After the division of the first data and the second data is completed, the CPU is responsible for performing soft decoding on the first data, and the first decoded data is obtained after decoding. It can be understood that, taking PNG data as an example, when performing soft decoding, the CPU sequentially decodes the compressed data in each IDAT data block. Therefore, the first decoded data includes all data obtained after decoding the first data.
S103:将第二数据发送至硬件解码器,以便硬件解码器对第二数据进行解码得到第二解码数据。S103: Send the second data to the hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data.
相应的,硬件解码器负责对第二数据进行解码。通常情况下,数据的划分在CPU能够访问的存储位置进行,而硬件解码器通常不具有主动读取数据的能力,因此在划分得到第二数据后,需要由CPU将第二数据发送至硬件解码器,以便其对第二数据进行解码得到第二解码数据。需要说明的是,S102步骤和S103步骤应当并行执行。Correspondingly, the hardware decoder is responsible for decoding the second data. Usually, the division of data is carried out in the storage location that can be accessed by the CPU, and the hardware decoder usually does not have the ability to actively read the data, so after the second data is divided, the CPU needs to send the second data to the hardware decoding device, so that it decodes the second data to obtain the second decoded data. It should be noted that step S102 and step S103 should be executed in parallel.
进一步的,在一种可行的实施方式中,在对第一数据以及第二数据的解码过程中,由于初始划分不准确,或者CPU计算资源分配变化等原因,可能导致CPU或硬件解码器中一方的负载过重或过轻,进而造成解码时间被延长或解码能力未被充分利用的问题。为了解决上述问题,在解码过程中,还可以根据解码情况对CPU和硬件解码器的负载进行均衡,尽可能充分的利用解码能力,减少解码时长。具体的,还可以执行如下步骤:Furthermore, in a feasible implementation manner, during the decoding process of the first data and the second data, due to reasons such as inaccurate initial division or changes in the allocation of CPU computing resources, one of the CPU or the hardware decoder may The load is too heavy or too light, which will cause the problem that the decoding time is prolonged or the decoding capacity is not fully utilized. In order to solve the above problems, during the decoding process, the load of the CPU and the hardware decoder can also be balanced according to the decoding situation, so as to make full use of the decoding capability as much as possible and reduce the decoding time. Specifically, the following steps can also be performed:
步骤41:若检测到满足负载平衡条件,则根据软解码情况,将待解码数据中的未处理部分重新划分为第三数据和第四数据。Step 41: If it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided into third data and fourth data.
步骤42:将第三数据作为新第一数据进行软解码,并将第四数据作为新第二数据发送至硬件解码器。Step 42: Perform soft decoding on the third data as new first data, and send the fourth data to the hardware decoder as new second data.
负载平衡条件,是指需要重新划分分配给CPU和硬件解码器的负载的 条件,其具体内容不做限定,例如CPU用于进行软解的计算资源发生变化导致软解所需时长发生变化,或者是发生变化的时长的变化幅度超过预设幅度。由于硬件解码器的解码能力通常固定不变,因此负载平衡条件的满足通常由软解码情况的变化引起。因此若检测到满足负载平衡条件,则根据软解码情况,将待解码数据中的未处理部分重新进行划分,得到第三数据和第四数据。其中,未处理部分包括第一数据中的未处理部分和/或第二数据中的未处理部分。在划分完毕后,将第三数据确定为新的第一数据,对其进行软解码,并将第四数据确定为新的第二数据进行硬解码。The load balancing condition refers to the condition that the load allocated to the CPU and the hardware decoder needs to be redistributed, and its specific content is not limited. For example, a change in the computing resources used by the CPU for soft solution results in a change in the time required for the soft solution, or It means that the variation range of the duration of the change exceeds the preset range. Since the decoding capability of the hardware decoder is usually fixed, the satisfaction of the load balancing condition is usually caused by the change of the soft decoding situation. Therefore, if it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided to obtain the third data and the fourth data. Wherein, the unprocessed part includes the unprocessed part in the first data and/or the unprocessed part in the second data. After the division is completed, the third data is determined as the new first data, which is soft-decoded, and the fourth data is determined as the new second data, which is hard-decoded.
具体的,软解码情况反映了CPU在软解过程中发生的变化,其具体可能为CPU提供了更多的计算资源进行软解,或者提供了更少的计算资源进行软解。因此,重新划分第三数据和第四数据的过程可以包括如下步骤:Specifically, the soft decoding situation reflects the changes of the CPU during the soft decoding process, which may specifically provide the CPU with more computing resources for soft decoding, or provide less computing resources for soft decoding. Therefore, the process of re-dividing the third data and the fourth data may include the following steps:
步骤51:若软解码情况为软解能力不足,则将未处理部分中第一数据对应的第一未处理部分划分为第三数据和第四数据,并将未处理部分中第二数据对应的第二未处理部分确定为第四数据。Step 51: If the soft decoding situation is that the soft decoding capability is insufficient, divide the first unprocessed part corresponding to the first data in the unprocessed part into third data and fourth data, and divide the unprocessed part corresponding to the second data The second unprocessed portion is determined as fourth data.
步骤52:若软解码情况为软解能力过剩,则将未处理部分中第一数据对应的第一未处理部分确定为第三数据,并将未处理部分中第二数据对应的第二未处理部分划分为第三数据和第四数据。Step 52: If the soft decoding situation is that the soft decoding capacity is excessive, determine the first unprocessed part corresponding to the first data in the unprocessed part as the third data, and determine the second unprocessed part corresponding to the second data in the unprocessed part The part is divided into third data and fourth data.
若软解码情况为软解能力不足,则说明CPU无法按照预先计划按时完成所有第一数据的解码。因此,将未处理部分中第一数据对应的第一未处理部分划分为第三数据和第四数据,即将原本由CPU负责的部分负载重新划分给硬件解码器进行处理,将未处理部分中第二数据对应的第二未处理部分确定为第四数据。If the soft decoding is that the soft decoding capability is insufficient, it means that the CPU cannot complete the decoding of all the first data on time according to the pre-plan. Therefore, the first unprocessed part corresponding to the first data in the unprocessed part is divided into third data and fourth data, that is, part of the load originally responsible by the CPU is redistributed to the hardware decoder for processing, and the unprocessed part The second unprocessed part corresponding to the second data is determined as the fourth data.
若软解码情况为软解能力过剩,则说明CPU提供了超过计划的计算资源进行解码。在这种情况下,将未处理部分中第二数据对应的第二未处理部分划分为第三数据和第四数据,即将原本由硬件解码器负责的部分负载重新划分给CPU进行处理,将未处理部分中第一数据对应的第一未处理部分确定为第三数据。If the soft decoding situation is that the soft decoding capacity is excessive, it means that the CPU provides more computing resources than planned for decoding. In this case, the second unprocessed part corresponding to the second data in the unprocessed part is divided into third data and fourth data, that is, part of the load originally responsible for the hardware decoder is redistributed to the CPU for processing, and the unprocessed part is divided into the third data and the fourth data. The first unprocessed part corresponding to the first data in the processed part is determined as the third data.
请参考图4,图4为本申请实施例提供的一种负载平衡流程图。可以看到,原本划分的第一数据为1M,第二数据为9M。在解码过程中,发现 CPU提供了比预计更多的计算资源进行软解,其软解能力出现了过剩。在这种情况下,由于硬件解码器按照头尾顺序对第二数据进行解码,因此可以从原本的9M中的尾部选取未被处理的第二未处理部分,并从中划分出1M大小作为第三数据,将剩余的第二未处理部分确定为第四数据。Please refer to FIG. 4 . FIG. 4 is a flow chart of load balancing provided by an embodiment of the present application. It can be seen that the originally divided first data is 1M, and the second data is 9M. During the decoding process, it was found that the CPU provided more computing resources than expected for soft decoding, and its soft decoding capacity was excessive. In this case, since the hardware decoder decodes the second data in head-to-tail order, the unprocessed second unprocessed part can be selected from the tail of the original 9M, and the 1M size can be divided as the third part data, and determine the remaining second unprocessed part as fourth data.
S104:利用第一解码数据和第二解码数据构成解码数据。S104: Use the first decoded data and the second decoded data to form decoded data.
在得到第一解码数据和第二解码数据后,可以利用其构成待解码数据对应的完成的解码数据。可以理解的是,通过将待解码数据划分为两个部分并分别进行软解和硬解,可以在单位时间内解码更多的数据,使得数据解码的速度更快。After the first decoded data and the second decoded data are obtained, they can be used to form completed decoded data corresponding to the data to be decoded. It can be understood that by dividing the data to be decoded into two parts and performing soft decoding and hard decoding respectively, more data can be decoded per unit time, making the speed of data decoding faster.
在一种实施方式中,硬解和软解可能无法同时完成,而只有得到所有的第一解码数据和第二解码数据,才能够利用其构成完整的解码数据。因此构成解码数据的过程可以包括如下步骤:In one embodiment, the hard solution and the soft solution may not be completed at the same time, and only when all the first decoded data and the second decoded data are obtained can they be used to form complete decoded data. Therefore, the process of forming decoded data may include the following steps:
步骤61:基于第一数据在待解码数据中的位置,将第一解码数据写入内存空间的第一位置。Step 61: Based on the position of the first data in the data to be decoded, write the first decoded data into the first position of the memory space.
步骤62:若检测到所有的第二解码数据,均基于第二数据在待解码数据中的位置,写入到内存空间的第二位置,则确定解码数据构成完毕。Step 62: If it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded, then it is determined that the decoded data is constructed.
通常情况下,硬件解码器能够对内存空间直接写入,因此无需CPU获取第二解码数据。在得到第一解码数据和第二解码数据后,由于第一解码数据和第二解码数据的写入位置关系到解码后得到完整的解码数据是否正确,因此在写入是,需要基于被解码的第一数据或第二数据在待解码数据中的位置将解码后得到的数据写入内存空间。CPU监控第二解码数据的写入情况,在检测到所有的第二解码数据均写入到内存空间后,可以确定全部解码完毕,进而确定解码数据构成完毕。Usually, the hardware decoder can directly write to the memory space, so there is no need for the CPU to obtain the second decoded data. After the first decoded data and the second decoded data are obtained, since the writing position of the first decoded data and the second decoded data is related to whether the complete decoded data obtained after decoding is correct or not, when writing, it needs to be based on the decoded The position of the first data or the second data in the data to be decoded writes the decoded data into the memory space. The CPU monitors the writing of the second decoded data, and after detecting that all the second decoded data is written into the memory space, it can determine that all the decoded data is completed, and then determine that the decoded data is formed.
请参考图5,图5为本申请实施例提供的一种具体的数据解码方法流程图,其具体用于对图片文件进行解码。在读取或通过网络获取到图片文件后,判断其类型是否为需要解码的类型,若不是,则按照常规方式对其进行处理。若需要解码,则获取该图像的大小、类型,用于后续确定解码方式。根据当前CPU的负载情况,以及硬件解码器的硬解能力(即解码模块能力),判断当前的图片的大小是否需要采用软解与硬解同时进行的处 理。若不需要,则采用常规方式对其进行处理。若需要,则由CPU进行图片文件的分解分包,将第二数据发送给硬件解码器,同时记录软解和硬解的数据包分发情况,以便进行平衡监控,若检测到一方输出快,满足负载平衡条件,则再次计算当前数据量并重新进行分发,以便保证软解和硬解的均衡,尽量使得二者同时完成。在解码完成后,整合两个解码模式下输出的数据内容,将其发送给终端或其他解码数据需求方。Please refer to FIG. 5 . FIG. 5 is a flowchart of a specific data decoding method provided by an embodiment of the present application, which is specifically used for decoding a picture file. After the image file is read or obtained through the network, it is judged whether its type is the type that needs to be decoded, and if not, it is processed in a conventional manner. If decoding is required, the size and type of the image are obtained for subsequent determination of the decoding method. According to the current CPU load and the hard decoding capability of the hardware decoder (that is, the decoding module capability), it is judged whether the size of the current picture needs to be processed simultaneously by soft decoding and hard decoding. If it is not needed, it is processed in the normal way. If necessary, the CPU will decompose and subpackage the picture file, send the second data to the hardware decoder, and record the distribution of the data packets of the soft solution and the hard solution at the same time, so as to perform balance monitoring. Load balancing conditions, recalculate the current data volume and redistribute it, so as to ensure the balance of soft solution and hard solution, and try to make the two complete at the same time. After the decoding is completed, the data content output in the two decoding modes is integrated and sent to the terminal or other decoded data demanders.
应用本申请实施例提供的数据解码方法,在进行数据解码时,为了提高数据解码速度,采用了软解和硬解结合的解码方式。具体的,处理器在获取到待解码数据后,将其划分两个部分,即第一数据和第二数据,第一数据由处理器进行软件解码,即软解码,得到第一解码数据;第二部分发送至硬件解码器进行硬解码,得到第二解码数据。在解码完毕后将第一解码数据和第二解码数据相组合,即可得到完整的解码数据。利用处理器的软解码能力对硬件解码器的解码能力进行进一步补充,利用软解和硬解并行的解码方式进行解码,可以进一步提高数据解码速度,减少数据解码所需的时长。Applying the data decoding method provided by the embodiment of the present application, when performing data decoding, in order to improve the speed of data decoding, a decoding method combining soft decoding and hard decoding is adopted. Specifically, after the processor obtains the data to be decoded, it divides it into two parts, that is, the first data and the second data, and the first data is decoded by the processor through software, that is, soft decoding, to obtain the first decoded data; The second part is sent to the hardware decoder for hard decoding to obtain the second decoded data. After the decoding is completed, the first decoded data and the second decoded data are combined to obtain complete decoded data. Use the soft decoding capability of the processor to further supplement the decoding capability of the hardware decoder, and use the soft decoding and hard decoding parallel decoding methods to perform decoding, which can further increase the data decoding speed and reduce the time required for data decoding.
下面对本申请实施例提供的数据解码装置进行介绍,下文描述的数据解码装置与上文描述的数据解码方法可相互对应参照。The data decoding device provided by the embodiment of the present application is introduced below, and the data decoding device described below and the data decoding method described above may be referred to in correspondence.
请参考图6,图6为本申请实施例提供的一种数据解码装置的结构示意图,包括:Please refer to FIG. 6. FIG. 6 is a schematic structural diagram of a data decoding device provided in an embodiment of the present application, including:
划分模块110,用于获取待解码数据,并将待解码数据划分为第一数据和第二数据;A dividing module 110, configured to acquire data to be decoded, and divide the data to be decoded into first data and second data;
软解模块120,用于对第一数据进行软解码,得到第一解码数据;The soft decoding module 120 is configured to perform soft decoding on the first data to obtain the first decoded data;
硬解模块130,用于将第二数据发送至硬件解码器,以便硬件解码器对第二数据进行解码得到第二解码数据;The hard decoding module 130 is configured to send the second data to the hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
构成模块140,用于利用第一解码数据和第二解码数据构成解码数据。A forming module 140, configured to use the first decoded data and the second decoded data to form decoded data.
可选地,划分模块110,包括:Optionally, the division module 110 includes:
大小判断单元,用于获取待解码数据,并判断待解码数据是否大于预设数据量阈值;A size judging unit, configured to acquire data to be decoded, and judge whether the data to be decoded is greater than a preset data volume threshold;
划分单元,用于若大于预设数据量阈值,则将待解码数据划分为第一数据和第二数据。The division unit is configured to divide the data to be decoded into first data and second data if it is greater than a preset data volume threshold.
可选地划分模块110,包括: Optionally partition module 110, comprising:
数据块识别单元,用于识别待解码数据中的头数据块、若干个文件数据块和尾数据块;A data block identification unit, configured to identify a header data block, several file data blocks and tail data blocks in the data to be decoded;
分割点确定单元,用于按照头尾顺序,按照预设比例在若干个文件数据块之间确定分割点;A split point determining unit, configured to determine a split point among several file data blocks according to a preset ratio according to the head-to-tail sequence;
数据块插入单元,用于在分割点处插入目标尾数据块,并在目标尾数据块后插入目标头数据块;A data block insertion unit is used to insert the target tail data block at the split point, and insert the target head data block after the target tail data block;
拆分确定单元,用于将头数据块、目标尾数据块以及头数据块至目标尾数据块之间的数据块确定为第一数据,并将目标头数据块、尾数据块以及从目标头数据块至尾数据块之间的数据块确定为第二数据;The split determination unit is used to determine the header data block, the target tail data block, and the data blocks between the header data block and the target tail data block as the first data, and determine the target header data block, the tail data block, and the data blocks from the target header The data block between the data block and the tail data block is determined as the second data;
其中,目标头数据块中的头信息与第二数据相匹配。Wherein, the header information in the target header data block matches the second data.
可选地,还包括:Optionally, also include:
硬解能力确定模块,用于确定硬件解码器对应的硬解能力;The hard solution capability determination module is used to determine the hard solution capability corresponding to the hardware decoder;
软解能力确定模块,用于确定在预设条件下的软解能力;A soft solution capability determination module is used to determine the soft solution capability under preset conditions;
比例确定模块,用于根据硬解能力和软解能力确定预设比例。The ratio determination module is used to determine the preset ratio according to the hard solution capability and the soft solution capability.
可选地,还包括:Optionally, also include:
重新划分模块,用于若检测到满足负载平衡条件,则根据软解码情况,将待解码数据中的未处理部分重新划分为第三数据和第四数据;A re-division module, configured to re-divide the unprocessed part of the data to be decoded into third data and fourth data according to the soft decoding situation if it is detected that the load balancing condition is met;
解码处理模块,用于将第三数据作为新第一数据进行软解码,并将第四数据作为新第二数据发送至硬件解码器。The decoding processing module is configured to perform soft decoding on the third data as new first data, and send the fourth data to the hardware decoder as new second data.
可选地,重新划分模块,包括:Optionally, repartition the modules, including:
第一划分单元,用于若软解码情况为软解能力不足,则将未处理部分中第一数据对应的第一未处理部分划分为第三数据和第四数据,并将未处理部分中第二数据对应的第二未处理部分确定为第四数据;The first division unit is used to divide the first unprocessed part corresponding to the first data in the unprocessed part into third data and fourth data if the soft decoding situation is that the soft decoding capability is insufficient, and divide the unprocessed part into the third data and the fourth data. The second unprocessed part corresponding to the second data is determined as the fourth data;
第二划分单元,用于若软解码情况为软解能力过剩,则将未处理部分中第一数据对应的第一未处理部分确定为第三数据,并将未处理部分中第二数据对应的第二未处理部分划分为第三数据和第四数据。The second division unit is used to determine the first unprocessed part corresponding to the first data in the unprocessed part as the third data if the soft decoding situation is that the soft decoding capability is excessive, and determine the corresponding part of the second data in the unprocessed part The second unprocessed portion is divided into third data and fourth data.
可选地,构成模块140,包括:Optionally, constitute module 140, including:
写入单元,用于基于第一数据在待解码数据中的位置,将第一解码数据写入内存空间的第一位置;A writing unit, configured to write the first decoded data into the first position of the memory space based on the position of the first data in the data to be decoded;
构成确定单元,用于若检测到所有的第二解码数据,均基于第二数据在待解码数据中的位置,写入到内存空间的第二位置,则确定解码数据构成完毕。The configuration determination unit is configured to determine that the configuration of the decoded data is completed if it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded.
下面对本申请实施例提供的电子设备进行介绍,下文描述的电子设备与上文描述的数据解码方法可相互对应参照。The electronic device provided by the embodiment of the present application is introduced below, and the electronic device described below and the data decoding method described above may be referred to in correspondence.
请参考图7,图7为本申请实施例提供的一种电子设备的结构示意图。其中电子设备100可以包括处理器101和存储器102,还可以进一步包括多媒体组件103、信息输入/信息输出(I/O)接口104以及通信组件105中的一种或多种。Please refer to FIG. 7 , which is a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 100 may include a processor 101 and a memory 102 , and may further include one or more of a multimedia component 103 , an information input/information output (I/O) interface 104 and a communication component 105 .
其中,处理器101用于控制电子设备100的整体操作,以完成上述的数据解码方法中的全部或部分步骤;存储器102用于存储各种类型的数据以支持在电子设备100的操作,这些数据例如可以包括用于在该电子设备100上操作的任何应用程序或方法的指令,以及应用程序相关的数据。该存储器102可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如静态随机存取存储器(Static Random Access Memory,SRAM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、只读存储器(Read-Only Memory,ROM)、磁存储器、快闪存储器、磁盘或光盘中的一种或多种。Among them, the processor 101 is used to control the overall operation of the electronic device 100 to complete all or part of the steps in the above data decoding method; the memory 102 is used to store various types of data to support the operation of the electronic device 100, these data For example, instructions for any application or method operating on the electronic device 100 may be included, as well as application-related data. The memory 102 can be realized by any type of volatile or non-volatile storage device or their combination, such as Static Random Access Memory (Static Random Access Memory, SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (Read-Only Memory, One or more of Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
多媒体组件103可以包括屏幕和音频组件。其中屏幕例如可以是触摸屏,音频组件用于输出和/或输入音频信号。例如,音频组件可以包括一个麦克风,麦克风用于接收外部音频信号。所接收的音频信号可以被进一步存储在存储器102或通过通信组件105发送。音频组件还包括至少一个扬声器,用于输出音频信号。I/O接口104为处理器101和其他接口模块之间提供 接口,上述其他接口模块可以是键盘,鼠标,按钮等。这些按钮可以是虚拟按钮或者实体按钮。通信组件105用于电子设备100与其他设备之间进行有线或无线通信。无线通信,例如Wi-Fi,蓝牙,近场通信(Near Field Communication,简称NFC),2G、3G或4G,或它们中的一种或几种的组合,因此相应的该通信组件105可以包括:Wi-Fi部件,蓝牙部件,NFC部件。 Multimedia components 103 may include screen and audio components. The screen can be, for example, a touch screen, and the audio component is used for outputting and/or inputting audio signals. For example, an audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 102 or sent via the communication component 105 . The audio component also includes at least one speaker for outputting audio signals. I/O interface 104 provides interface between processor 101 and other interface modules, and above-mentioned other interface modules can be keyboard, mouse, button etc. These buttons can be virtual buttons or physical buttons. The communication component 105 is used for wired or wireless communication between the electronic device 100 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, near field communication (Near Field Communication, NFC for short), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 105 may include: Wi-Fi parts, Bluetooth parts, NFC parts.
电子设备100可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,简称ASIC)、数字信号处理器(Digital Signal Processor,简称DSP)、数字信号处理设备(Digital Signal Processing Device,简称DSPD)、可编程逻辑器件(Programmable Logic Device,简称PLD)、现场可编程门阵列(Field Programmable Gate Array,简称FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述实施例给出的数据解码方法。The electronic device 100 may be implemented by one or more Application Specific Integrated Circuit (ASIC for short), Digital Signal Processor (DSP for short), Digital Signal Processing Device (DSPD for short), Programmable Logic Device (Programmable Logic Device, PLD for short), Field Programmable Gate Array (Field Programmable Gate Array, FPGA for short), controller, microcontroller, microprocessor or other electronic components are implemented for implementing the above embodiments The given data decoding method.
下面对本申请实施例提供的计算机可读存储介质进行介绍,下文描述的计算机可读存储介质与上文描述的数据解码方法可相互对应参照。The computer-readable storage medium provided by the embodiments of the present application is introduced below, and the computer-readable storage medium described below and the data decoding method described above may be referred to in correspondence.
本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述的数据解码方法的步骤。The present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned data decoding method are implemented.
该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc., which can store program codes. medium.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for relevant details, please refer to the description of the method part.
本领域技术人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经 按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本申请的范围。Those skilled in the art can further appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the hardware and software In the above description, the components and steps of each example have been generally described according to their functions. Whether these functions are executed by means of hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may implement the described functionality using different methods for each particular application, but such implementation should not be considered as exceeding the scope of the present application.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语包括、包含或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。Finally, it should also be noted that in this article, relationships such as first and second etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Moreover, the term comprises, comprises, or any other variation is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements but also other elements not expressly listed, or Yes also includes elements inherent to such a process, method, article, or device.
本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。In this paper, specific examples are used to illustrate the principles and implementation methods of the application. The descriptions of the above embodiments are only used to help understand the method and core idea of the application; meanwhile, for those of ordinary skill in the art, according to the application There will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be construed as limiting the application.

Claims (10)

  1. 一种数据解码方法,其特征在于,包括:A data decoding method, characterized in that, comprising:
    获取待解码数据,并将所述待解码数据划分为第一数据和第二数据;acquiring data to be decoded, and dividing the data to be decoded into first data and second data;
    对所述第一数据进行软解码,得到第一解码数据;performing soft decoding on the first data to obtain first decoded data;
    将所述第二数据发送至硬件解码器,以便所述硬件解码器对所述第二数据进行解码得到第二解码数据;sending the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
    利用所述第一解码数据和所述第二解码数据构成解码数据。Decoded data is constructed using the first decoded data and the second decoded data.
  2. 根据权利要求1所述的数据解码方法,其特征在于,所述获取待解码数据,并将所述待解码数据划分为第一数据和第二数据,包括:The data decoding method according to claim 1, wherein said acquiring data to be decoded and dividing said data to be decoded into first data and second data comprises:
    获取所述待解码数据,并判断所述待解码数据是否大于预设数据量阈值;Acquiring the data to be decoded, and judging whether the data to be decoded is greater than a preset data volume threshold;
    若大于所述预设数据量阈值,则将所述待解码数据划分为所述第一数据和所述第二数据。If it is greater than the preset data volume threshold, divide the data to be decoded into the first data and the second data.
  3. 根据权利要求1所述的数据解码方法,其特征在于,所述将所述待解码数据划分为第一数据和第二数据,包括:The data decoding method according to claim 1, wherein said dividing the data to be decoded into first data and second data comprises:
    识别所述待解码数据中的头数据块、若干个文件数据块和尾数据块;identifying the header data block, several file data blocks and tail data blocks in the data to be decoded;
    按照头尾顺序,按照预设比例在所述若干个文件数据块之间确定分割点;Determining split points among the plurality of file data blocks according to a preset ratio according to the head-to-tail order;
    在所述分割点处插入目标尾数据块,并在所述目标尾数据块后插入目标头数据块;Inserting a target tail data block at the split point, and inserting a target head data block after the target tail data block;
    将所述头数据块、所述目标尾数据块以及所述头数据块至所述目标尾数据块之间的数据块确定为所述第一数据,并将所述目标头数据块、所述尾数据块以及从所述目标头数据块至所述尾数据块之间的数据块确定为所述第二数据;determining the head data block, the target tail data block, and data blocks between the head data block and the target tail data block as the first data, and setting the target head data block, the The tail data block and the data blocks between the target head data block and the tail data block are determined as the second data;
    其中,所述目标头数据块中的头信息与所述第二数据相匹配。Wherein, the header information in the target header data block matches the second data.
  4. 根据权利要求3所述的数据解码方法,其特征在于,还包括:The data decoding method according to claim 3, further comprising:
    确定所述硬件解码器对应的硬解能力;determining the hardware decoding capability corresponding to the hardware decoder;
    确定在预设条件下的软解能力;Determine the soft solution capability under preset conditions;
    根据所述硬解能力和所述软解能力确定所述预设比例。The preset ratio is determined according to the hard solution capability and the soft solution capability.
  5. 根据权利要求1所述的数据解码方法,其特征在于,还包括:The data decoding method according to claim 1, further comprising:
    若检测到满足负载平衡条件,则根据软解码情况,将所述待解码数据中的未处理部分重新划分为第三数据和第四数据;If it is detected that the load balancing condition is satisfied, according to the soft decoding situation, the unprocessed part of the data to be decoded is re-divided into third data and fourth data;
    将所述第三数据作为新第一数据进行软解码,并将所述第四数据作为新第二数据发送至硬件解码器。performing soft decoding on the third data as new first data, and sending the fourth data to a hardware decoder as new second data.
  6. 根据权利要求5所述的数据解码方法,其特征在于,所述根据软解码情况,将所述待解码数据中未经解码的部分重新划分为第三数据和第四数据,包括:The data decoding method according to claim 5, wherein, according to the soft decoding situation, re-dividing the undecoded part of the data to be decoded into third data and fourth data includes:
    若所述软解码情况为软解能力不足,则将所述未处理部分中所述第一数据对应的第一未处理部分划分为所述第三数据和所述第四数据,并将所述未处理部分中所述第二数据对应的第二未处理部分确定为所述第四数据;If the soft decoding situation is that the soft decoding capability is insufficient, divide the first unprocessed part corresponding to the first data in the unprocessed part into the third data and the fourth data, and divide the The second unprocessed part corresponding to the second data in the unprocessed part is determined as the fourth data;
    若所述软解码情况为软解能力过剩,则将所述未处理部分中所述第一数据对应的第一未处理部分确定为所述第三数据,并将所述未处理部分中所述第二数据对应的第二未处理部分划分为所述第三数据和所述第四数据。If the soft decoding situation is that the soft decoding capability is excessive, the first unprocessed part corresponding to the first data in the unprocessed part is determined as the third data, and the unprocessed part in the The second unprocessed part corresponding to the second data is divided into the third data and the fourth data.
  7. 根据权利要求1所述的数据解码方法,其特征在于,所述利用所述第一解码数据和所述第二解码数据构成解码数据,包括:The data decoding method according to claim 1, wherein said using said first decoded data and said second decoded data to form decoded data comprises:
    基于所述第一数据在所述待解码数据中的位置,将所述第一解码数据写入内存空间的第一位置;writing the first decoded data into a first position in memory space based on the position of the first data in the data to be decoded;
    若检测到所有的所述第二解码数据,均基于所述第二数据在所述待解码数据中的位置,写入到所述内存空间的第二位置,则确定所述解码数据构成完毕。If it is detected that all the second decoded data are written into the second position of the memory space based on the position of the second data in the data to be decoded, it is determined that the decoded data is formed.
  8. 一种数据解码装置,其特征在于,包括:A data decoding device is characterized in that it comprises:
    划分模块,用于获取待解码数据,并将所述待解码数据划分为第一数据和第二数据;A division module, configured to obtain data to be decoded, and divide the data to be decoded into first data and second data;
    软解模块,用于对所述第一数据进行软解码,得到第一解码数据;A soft decoding module, configured to perform soft decoding on the first data to obtain first decoded data;
    硬解模块,用于将所述第二数据发送至硬件解码器,以便所述硬件解码器对所述第二数据进行解码得到第二解码数据;a hard decoding module, configured to send the second data to a hardware decoder, so that the hardware decoder decodes the second data to obtain second decoded data;
    构成模块,用于利用所述第一解码数据和所述第二解码数据构成解码数据。A constituting module, configured to construct decoded data by using the first decoded data and the second decoded data.
  9. 一种电子设备,其特征在于,包括存储器和处理器,其中:An electronic device, comprising a memory and a processor, wherein:
    所述存储器,用于保存计算机程序;The memory is used to store computer programs;
    所述处理器,用于执行所述计算机程序,以实现如权利要求1至7任一项所述的数据解码方法。The processor is configured to execute the computer program to implement the data decoding method according to any one of claims 1-7.
  10. 一种计算机可读存储介质,其特征在于,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的数据解码方法。A computer-readable storage medium, characterized by being used to store a computer program, wherein the computer program implements the data decoding method according to any one of claims 1 to 7 when executed by a processor.
PCT/CN2022/130860 2021-11-10 2022-11-09 Data decoding method and apparatus, electronic device and readable storage medium WO2023083213A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111326932.1 2021-11-10
CN202111326932.1A CN114071154A (en) 2021-11-10 2021-11-10 Data decoding method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
WO2023083213A1 true WO2023083213A1 (en) 2023-05-19

Family

ID=80274526

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/130860 WO2023083213A1 (en) 2021-11-10 2022-11-09 Data decoding method and apparatus, electronic device and readable storage medium

Country Status (2)

Country Link
CN (1) CN114071154A (en)
WO (1) WO2023083213A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114071154A (en) * 2021-11-10 2022-02-18 湖南国科微电子股份有限公司 Data decoding method and device, electronic equipment and readable storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105635740A (en) * 2014-10-27 2016-06-01 阿里巴巴集团控股有限公司 Method and device for decoding images
CN106782578A (en) * 2016-12-06 2017-05-31 努比亚技术有限公司 A kind of distributed solution code controller, distributed coding/decoding method and voice frequency terminal
US20170310342A1 (en) * 2016-04-25 2017-10-26 SK Hynix Inc. Early selection decoding and automatic tuning
CN107592118A (en) * 2016-07-08 2018-01-16 华为技术有限公司 The coding/decoding method and device of Variable Length Code file
CN108282164A (en) * 2017-01-05 2018-07-13 腾讯科技(深圳)有限公司 A kind of data encoding and coding/decoding method and device
CN111147926A (en) * 2018-11-02 2020-05-12 杭州海康威视数字技术股份有限公司 Data transcoding method and device
CN111836101A (en) * 2019-04-19 2020-10-27 深圳市茁壮网络股份有限公司 Video playing method and device
CN112119593A (en) * 2019-07-25 2020-12-22 深圳市大疆创新科技有限公司 Data processing method and system, encoder and decoder
CN114071154A (en) * 2021-11-10 2022-02-18 湖南国科微电子股份有限公司 Data decoding method and device, electronic equipment and readable storage medium
CN114422799A (en) * 2022-01-24 2022-04-29 北京百度网讯科技有限公司 Video file decoding method and device, electronic equipment and program product

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3540183B2 (en) * 1999-01-21 2004-07-07 株式会社東芝 Multilink communication device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105635740A (en) * 2014-10-27 2016-06-01 阿里巴巴集团控股有限公司 Method and device for decoding images
US20170310342A1 (en) * 2016-04-25 2017-10-26 SK Hynix Inc. Early selection decoding and automatic tuning
CN107592118A (en) * 2016-07-08 2018-01-16 华为技术有限公司 The coding/decoding method and device of Variable Length Code file
CN106782578A (en) * 2016-12-06 2017-05-31 努比亚技术有限公司 A kind of distributed solution code controller, distributed coding/decoding method and voice frequency terminal
CN108282164A (en) * 2017-01-05 2018-07-13 腾讯科技(深圳)有限公司 A kind of data encoding and coding/decoding method and device
CN111147926A (en) * 2018-11-02 2020-05-12 杭州海康威视数字技术股份有限公司 Data transcoding method and device
CN111836101A (en) * 2019-04-19 2020-10-27 深圳市茁壮网络股份有限公司 Video playing method and device
CN112119593A (en) * 2019-07-25 2020-12-22 深圳市大疆创新科技有限公司 Data processing method and system, encoder and decoder
CN114071154A (en) * 2021-11-10 2022-02-18 湖南国科微电子股份有限公司 Data decoding method and device, electronic equipment and readable storage medium
CN114422799A (en) * 2022-01-24 2022-04-29 北京百度网讯科技有限公司 Video file decoding method and device, electronic equipment and program product

Also Published As

Publication number Publication date
CN114071154A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
US10476928B2 (en) Network video playback method and apparatus
JP2008065834A (en) Fusion memory device and method
US10601891B2 (en) Cloud streaming service system and cloud streaming service method for utilizing an optimal GPU for video decoding based on resource conditions, and apparatus for the same
CN109840879B (en) Image rendering method and device, computer storage medium and terminal
CN106507200B (en) Video playing content insertion method and system
US20170180746A1 (en) Video transcoding method and electronic apparatus
CN109542361A (en) A kind of distributed memory system file reading, system and relevant apparatus
WO2020155964A1 (en) Audio/video switching method and apparatus, and computer device and readable storage medium
WO2023083213A1 (en) Data decoding method and apparatus, electronic device and readable storage medium
US20210211777A1 (en) Information Presenting Method, Terminal Device, Server and System
US11374843B2 (en) Method for measuring network speed, computing device, and computer-program product
WO2017129119A1 (en) Image drawing method, user equipment, server, and system
CN113873255B (en) Video data transmission method, video data decoding method and related devices
CN113226501A (en) Streaming media image providing device and method for application program
WO2018171548A1 (en) Decoding method, terminal and computer-readable storage medium
CN110611842B (en) Video transmission management method based on virtual machine and related device
CN109495776B (en) Audio sending and playing method and intelligent terminal
CN109587561B (en) Video processing method and device, electronic equipment and storage medium
US11463494B2 (en) Balance of initial frame and limitation of traffic
CN109597566B (en) Data reading and storing method and device
US10489350B2 (en) Data compression with inline compression metadata
CN110045924B (en) Hierarchical storage method and device, electronic equipment and computer readable storage medium
CN108234552B (en) Data storage method and device
KR102231875B1 (en) Apparatus and method for providing streaming video or application program
CN110677728B (en) Method, device and equipment for playing video and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22892007

Country of ref document: EP

Kind code of ref document: A1