Improved soft and hard duplex automatic error correction decoding method based on mercuric chloride DVPP hard decoding

By introducing a dual-soft software and hard automatic error correction decoding method in Ascend DVPP hard decoding, the problem of hard decoding fails in some formats of image decoding, and the image decoding support for various encoding formats is realized to ensure the stability and high performance of the decoding task.

CN120075443AActive Publication Date: 2025-05-30四川华鲲振宇智能科技有限责任公司 +1
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510527915.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-05-30
Estimated Expiration
2045-04-25

AI Technical Summary

Technical Problem

The existing Ascend DVPP hardware decoding fails to decode images in some formats, and the supported formats are limited, resulting in the problems of decoding failure and abnormal program exit.

Method used

Using the software and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding, we use the software and hard dual automatic error correction decoding method to determine whether the image format supports DVPP decoding by reading original image data, feature extraction and format analysis. If supported, perform DVPP hard decoding; otherwise, use the OpenCV library to perform soft decoding on the CPU side to ensure that all formats of images are successfully decoding.

Benefits of technology

It solves the problem of DVPP failing to decode images in some formats, adds a rich ecosystem of soft decoding, supports image decoding in various encoding formats, avoids abnormal program exit caused by DVPP decoding failure, and maintains the high performance of DVPP decoding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075443A_ABST
    Figure CN120075443A_ABST
Patent Text Reader

Abstract

The invention relates to an improved soft and hard duplex automatic error correction decoding method based on mercuric chloride DVPP hard decoding, which comprises the following steps: reading original image data, and obtaining the original size of each frame of image; performing feature extraction on the original image data, analyzing an image format based on image features, judging whether format information DVPP of an image supports or not, if so, calculating decoding information according to the size of the original image, adaptively creating a decoding output memory space, copying the original image data in the memory to the DVPP, and decoding according to a set decoding format; if not, an OpenCV library is used for a soft decoding algorithm at the CPU end, it is ensured that formats which are not supported by the DVPP can be decoded successfully, program exception caused by DVPP decoding failure is avoided, and soft decoding of the general graphic coding formats of the industry supports decoding. The problem that DVPP fails to decode images in partial formats is solved, rich ecology of soft decoding is added, decoding of images in various coding formats is supported, and the situation that a decoding task fails due to DVPP decoding failure, and a program is quitted is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of DVPP decoding, and particularly relates to a software-hardware dual-link automatic error correction decoding method improved based on Ascend DVPP hardware decoding. Background Art

[0002] The existing Ascend DVPP hardware decoding can indeed be many times faster than software decoding in terms of decoding performance. However, due to its own limited characteristics and less rich ecosystem compared with software decoding, the DVPP hardware decoding may fail to decode in some cases where the format is not supported or the vertical dimension of the picture is not 1, etc.

[0003] The specific method of traditional DVPP hardware decoding is as follows: Read the original image data: Obtain the original size, image format, and original image data of each frame of the image.

[0004] DVPP decoding: Manually set the decoding output format to create a decoding output memory space, copy the original image data in the memory to DVPP, and perform decoding according to the set decoding format. The formats supported by DVPP decoding are limited, and the detailed constraints are as follows: Hardware constraints: It supports a maximum of 4 Huffman tables, including 2 DC (Direct Current) tables and 2 AC (Alternating Current) tables; It supports a maximum of 3 quantization tables; It only supports 8-bit sampling accuracy; It only supports decoding sequential-encoded pictures; It only supports JPEG format decoding based on DCT (Discrete Cosine Transform); It only supports decoding pictures with one SOS (Start of Scan) flag; Decoding success: After successful decoding, copy the decoded data back to the memory to complete the decoding; Decoding failure: If the decoding fails, the program will exit abnormally.

[0005] Software constraints: It supports decoding pictures with 3 SOS flags; It supports decoding abnormal pictures with insufficient mcu (Minimum Coded Unit) data.

[0006] Therefore, how to solve the problem of DVPP decoding failure for some format images, add the rich ecosystem of software decoding, support the decoding of images in various coding formats, and prevent the decoding task from failing and the program from exiting due to DVPP decoding failure is a technical problem that needs to be solved urgently at present. Summary of the Invention

[0007] The object of the present invention is to provide a hard-soft dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding, so as to solve the problem that DVPP fails to decode images in some formats, incorporate the rich ecosystem of soft decoding, support image decoding in various coding formats, and prevent the decoding task from failing and the program from exiting due to DVPP decoding failure, thereby realizing the incorporation of the rich ecosystem of soft decoding, supporting image decoding in various coding formats, and having the high performance of DVPP decoding.

[0008] To solve the above technical problems, the technical solution adopted by the present invention is as follows: A hard-soft dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding includes the following steps: S1: Read the original image data and obtain the original image information of each frame of image with the original size. S2: Extract features from the original image data, analyze the image format based on the extracted image features and read the format information of the image, and determine whether the DVPP supports the format information of the image. If so, execute step S3; if not, execute step S4. S3: Calculate the decoding information according to the original image size, adaptively create a decoding output memory space, and copy the original image data in the memory to DVPP for decoding according to the set decoding format. Since the formats supported by DVPP decoding are limited. S4: Use the OpenCV library on the CPU side to perform a soft decoding algorithm to ensure that formats not supported by DVPP can be successfully decoded, avoid program exceptions caused by DVPP decoding failure, and support soft decoding of general graphic coding formats in the industry. S5: Complete decoding based on the above hard-soft dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding.

[0009] Preferably, the specific process of reading the original image data in step S1 and obtaining the original size, image format, and original image information of each frame of image is as follows: S11: Preset an image processing library in the system and read the original image data based on the interface of the image processing library. S12: Import the image module, open the original image data using the preset path, and obtain the original size, original image format, and original image information of the color mode of the image, and obtain the RGB information of each pixel in the original image through nested loops.

[0010] Preferably, the specific process of extracting features from the original image data in step S2, analyzing the image format based on the extracted image features, and reading the format information of the image is as follows: S21: Divide the original image into feature extraction regions of MxM. S22: For each pixel point in each feature extraction region, obtain the pixel points within the neighborhood of this pixel point, compare the pixel value of this pixel point with the pixel values of a specified number of pixel points within the neighborhood, mark the pixel points in the feature extraction region whose pixel values are greater than the pixel value of the central pixel point as 1, otherwise mark them as 0; S23: Calculate the histogram of each feature extraction region, and perform normalization processing on most of the histograms; S24: Connect the peer histograms of each obtained feature extraction region to form the feature vector of the original image, match the feature vector of the original image with the feature vectors of various image formats, and obtain the original image format according to the matching result.

[0011] Preferably, the specific process of step S3 is as follows: S31: Calculate the total number of pixels of the original image through resolution * frame rate, and calculate and create the decoded output memory space according to how many bits of storage space each pixel uses; for example, for a BMP picture with a resolution of 800X600, it has 480,000 pixel points, and then one pixel point is 24-bit true color, 800×600×24 / 8 = 1,440,000 bytes. This is the storage space of one frame, that is, the required space for a static picture, and then multiplying by the number of frames is the total storage space. The general calculation formula: storage space = resolution * frame rate * the number of bytes required for each pixel; S32: Convert the original image to the YUV format, and perform discrete cosine transform on each MxM region divided by the original image respectively; S33: Obtain the color component data of each region of the original image, read the color component data stream until it is consistent with one of the leaf nodes of the Huffman tree, and use the Huffman tree to find the weight value corresponding to the leaf node; S34: Continuously read the bit data of the original image until the read component coding is consistent with one of the leaf nodes of the Huffman tree of the component method and find the weight value corresponding to the leaf node, and repeat the process of finding the weight value until the preset end condition is met.

[0012] Preferably, the specific process of using the OpenCV library to perform the soft decoding algorithm on the CPU side in step S4: S41: Extract the original image after obtaining the original image format in step S24, and obtain the specified key parameters in the original image format; S42: Obtain the pixel data of the original image, store the pixel data in a specified array according to the specified key parameters, convert the original image to a grayscale image, and release the resources.

[0013] The beneficial effects of the present invention include: The software-hardware dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding provided by the present invention reads the original image data, obtains the original size of each frame of the image, extracts the features of the original image data, analyzes the image format based on the image features, and determines whether the DVPP supports the format information of the image. If so, it calculates the decoding information according to the original image size, adaptively creates the decoding output memory space, copies the original image data in the memory to the DVPP, and performs decoding according to the set decoding format; if not, it uses the OpenCV library on the CPU side to perform the software decoding algorithm to ensure that the formats not supported by the DVPP can be successfully decoded, avoid program exceptions caused by DVPP decoding failures, and support the software decoding of general graphic coding formats in the industry. It solves the problem of DVPP decoding failure for some format images, adds the rich ecosystem of software decoding, supports the decoding of images in various coding formats, and will not cause the decoding task to fail and the program to exit due to DVPP decoding failure.

[0014] First, the image format parsing code parses the image format and automatically determines whether to use DVPP or CPU decoding to complete the task. The key code in the parsing part is the analysis result of multiple important experimental tests during the research and development process, which can quickly analyze whether DVPP decoding is possible.

[0015] Secondly, the dual-link decoding strategy of DVPP hard decoding and CPU soft decoding. Tasks that cannot be decoded by DVPP are uniformly implemented using CPU soft decoding. This strategy is an innovative point in the industry. It automatically corrects the errors that cannot be decoded by DVPP and decodes normally, solves the problem of DVPP decoding failure for some format images, has the high performance of DVPP decoding, adds the rich ecosystem of software decoding, supports the decoding of images in various coding formats, and will not cause the decoding task to fail and the program to exit due to DVPP decoding failure. Brief Description of the Drawings

[0016] Figure 1 It is a flow chart of the traditional software-hardware dual-link automatic error correction decoding method.

[0017] Figure 2 It is a flow chart of the software-hardware dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding of the present invention. Detailed Embodiment

[0018] The following further elaborates on the present invention in conjunction with the attached Figures 1 - 2 For a more detailed description: Embodiment 1 Refer to the attached Figure 2 As shown, the software-hardware dual-link automatic error correction decoding method improved based on Ascend DVPP hard decoding includes the following steps: S1: Read the original image data and obtain the original image information of the original size of each frame of the image; S2: Extract features from the original image data, analyze the image format based on the extracted image features, read the format information of the image, and determine whether the format information DVPP supports. If so, execute step S3; if not, execute step S4; S3: Calculate the decoding information according to the original image size, adaptively create the decoding output memory space. Since the DVPP decoding supports limited formats, copy the original image data in the memory to DVPP for decoding according to the set decoding format; S4: Use the OpenCV library on the CPU side to perform a soft decoding algorithm to ensure that formats not supported by DVPP can be successfully decoded, avoiding program exceptions caused by DVPP decoding failures. The soft decoding of the general graphic coding formats in the industry is supported; S5: Complete the decoding based on the improved dual - link automatic error - correction decoding method of Ascend DVPP hard decoding described above.

[0019] See Figure 1 As shown, in the traditional DVPP hard decoding process, read the original image data: obtain the original size, image format, and original image data of each frame. DVPP decoding: manually set the decoding output format to create the decoding output memory space, copy the original image data in the memory to DVPP for decoding according to the set decoding format. The DVPP decoding supports limited formats, and the detailed constraints include hardware constraints and software constraints. Decoding success: After successful decoding, copy the decoded data back to the memory to complete the decoding. Decoding failure: If the decoding fails, the program will exit abnormally.

[0020] Among them, the hardware constraints are as follows: It supports a maximum of 4 Huffman tables, including 2 DC (Direct Current) tables and 2 AC (Alternating Current) tables.

[0021] It supports a maximum of 3 quantization tables, It only supports 8 - bit sampling precision.

[0022] It only supports decoding sequential - coded pictures, It only supports JPEG format decoding based on the DCT (Discrete Cosine Transform) transform, It only supports decoding pictures with one SOS (Start of Scan) flag.

[0023] The software constraints are as follows: It supports decoding pictures with 3 SOS flags.

[0024] It supports decoding abnormal pictures with insufficient mcu (Minimum Coded Unit) data.

[0025] The present invention improves the traditional DVPP hard decoding process. By reading the original image data, obtaining the original size of each frame of the image, extracting features from the original image data, analyzing the image format based on the image features, and determining whether the DVPP supports the format information of the image. If so, calculate the decoding information according to the original image size, adaptively create a decoded output memory space, copy the original image data in the memory to the DVPP for decoding according to the set decoding format; if not, use the OpenCV library on the CPU side to perform a soft decoding algorithm to ensure that formats not supported by the DVPP can be successfully decoded, avoiding program exceptions caused by DVPP decoding failures. The soft decoding of the general graphic coding formats in the industry supports the decoding process, solves the problem of DVPP decoding failures for some format images, adds a rich soft decoding ecosystem, supports the decoding of images in various coding formats, and does not cause the decoding task to fail and the program to exit due to DVPP decoding failures.

[0026] Part of the code for the above process is as follows: Data-Info data- info, if(filevec-.empty()){ ACLLITE –LOG- ERROR("Failed to deal all empty path"); return ACLLITE- ERROR; } if(frameCnt- == fileVec-.size()){ carDetectDataMsg->isLastFrame =1; return ACLLITE-OK; std::string picFile =fileVec-[frameCnt ]; / / cout<<"file name:"<<picFile<<endl; / / 01 Read the original data AclLiteError ret =ReadData(carDetectDataMsg->imageFrame, picFile); / / 02 Analyze the image format AclLiteError ret = AnalyzeData(carDetectDataMsg->imageFrame, datainfo); / / 03 Determine whether the image format should be decoded by DVPP or CPU software decoding switch(data-info.decode-type) { case TYPE DVPP: / * code * / / / 04 DVPP hardware decoding AclLiteError ret=ProcessData DVPp(carDetectDataMsg,picFile); break; case TYPE-CPU: / * code * / / 05 CPU software decoding AclLiteError ret= ProcessDataCPU(carDetectDataMsg,picFile): break; default: break; Example 2 Based on Example 1, the specific process of reading the original image data in step S1 to obtain the original size, image format, and original image information of each frame of the image is as follows: S11: Preset an image processing library in the system, and read the original image data based on the interface of the image processing library; S12: Import the image module, open the original image data using the preset path, and obtain the original size, original image format, and original image information of the color mode of the image, and obtain the RGB information of each pixel in the original image through nested loops.

[0027] In this embodiment, the specific process of performing feature extraction on the original image data in step S2, analyzing the image format based on the extracted image features, and reading the format information of the image is as follows: S21: Divide the original image into MxM feature extraction regions; S22: For each pixel point in each feature extraction region, obtain the pixel points in the neighborhood of the pixel point, compare the pixel value of the pixel point with the pixel values of the specified number of pixel points in the neighborhood, and mark the pixel points whose pixel values in the feature extraction region are greater than the pixel value of the central pixel point as 1, otherwise mark them as 0; S23: Calculate the histogram of each feature extraction region, and normalize the majority histogram; S24: Concatenate the co - level histograms of each obtained feature extraction region to form a feature vector of the original image. Match the feature vector of the original image with the feature vectors of various image formats, and obtain the original image format according to the matching result.

[0028] Embodiment 3 Based on Embodiment 1 or Embodiment 2, the specific process of step S3 is as follows: S31: Calculate the total number of pixels of the original image by resolution * frame rate, and calculate and create a decoded output memory space according to how many bits of storage space each pixel uses; for example: for a BMP picture with a resolution of 800X600, it has 480,000 pixel points, and one pixel point is 24 - bit true color, 800×600×24 / 8 = 1,440,000 bytes. This is the storage space for one frame, that is, the required space for a static picture. Multiply it by the number of frames to get the total storage space. The general calculation formula: storage space = resolution * frame rate * number of bytes required for each pixel; S32: Convert the original image to the YUV format, and perform discrete cosine transform on each MxM region divided by the original image respectively; S33: Obtain the color component data of each region of the original image, read the color component data stream until it is consistent with a certain leaf node of the Huffman tree, and use the Huffman tree to find the weight value corresponding to the leaf node; S34: Continuously read the bit data of the original image until the read component encoding is consistent with a certain leaf node of the Huffman tree of the component method and find the weight value corresponding to the leaf node. Repeat the process of finding the weight value until the preset end condition is met.

[0029] In this embodiment, the specific process of using the OpenCV library to perform a soft decoding algorithm on the CPU side in step S4: S41: Extract the original image after obtaining the original image format in step S24, and obtain the specified key parameters in the original image format; S42: Obtain the pixel data of the original image, store the pixel data in a specified array according to the specified key parameters, convert the original image to a grayscale image, and release the resources.

[0030] In summary, the proposed method for dual-mode automatic error correction decoding based on the improvement of Ascend DVPP hard decoding reads the original image data and obtains the original size of each frame of the image. It extracts features from the original image data, analyzes the image format based on the image features, and determines whether the DVPP supports the format information of the image. If so, it calculates the decoding information according to the original image size, adaptively creates the decoding output memory space, copies the original image data in the memory to the DVPP, and performs decoding according to the set decoding format. Otherwise, it uses the OpenCV library on the CPU side to perform the soft decoding algorithm to ensure that the formats not supported by the DVPP can be successfully decoded, avoiding program exceptions caused by DVPP decoding failures. The soft decoding of the general graphic coding formats in the industry all supports decoding. This solves the problem of DVPP decoding failure for some format images, adds the rich ecosystem of soft decoding, supports the decoding of images in various coding formats, and prevents the decoding task from failing and the program from exiting due to DVPP decoding failures.

[0031] Through the image format parsing code, the image format is parsed and it is automatically determined whether to use DVPP or CPU decoding to complete the task. The key code of the parsing part is the result of the analysis of many important experimental tests during the R & D process, which can quickly analyze whether DVPP decoding is possible. The dual-mode decoding strategy of DVPP hard decoding and CPU soft decoding is adopted. Tasks that cannot be decoded by DVPP are uniformly implemented using CPU soft decoding. This strategy is an innovation in the industry. It can automatically correct the errors that cannot be decoded by DVPP and perform normal decoding, solving the problem of DVPP decoding failure for some format images. It has the high performance of DVPP decoding, adds the rich ecosystem of soft decoding, supports the decoding of images in various coding formats, and prevents the decoding task from failing and the program from exiting due to DVPP decoding failures.

Claims

1. The improved soft and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding is characterized by: The following steps are involved: S1: Read the original image data to obtain the original image information of each frame with the original size; S2: extracting image features from the original image data, analyzing the image format based on the extracted image features and reading the image format information, determining whether the image format information DVPP supports, if so, executing step S3, if not, executing step S4; S3: Calculate the decoding information according to the original image size, and adaptively create the decoding output memory space. Since DVPP decoding supports limited formats, the original image data in the memory is copied to DVPP for decoding according to the set decoding format; S4: Use OpenCV library as soft decoding algorithm on the CPU side to ensure that formats not supported by DVPP can be decoded successfully, avoiding program abnormalities caused by DVPP decoding failure. The industry's general graphics coding format soft decoding supports decoding; S5: Decoding is completed using the improved soft and hard dual automatic error correction decoding method based on the Ascend DVPP hard decoding described above.

2. The improved soft and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding according to claim 1 is characterized in that: The specific process of reading the original image data in step S1 and obtaining the original size, image format, and original image information of each frame of image is as follows: S11: Preset an image processing library in the system, and read the original image data based on an interface of the image processing library; S12: Importing an image module, using a preset path to open the original image data, and obtaining the original image information of the original size, original image format, and color mode of the image, and obtaining the RGB information of each pixel in the original image through a nested loop.

3. The improved soft and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding according to claim 1 is characterized in that: In step S2, the specific process of extracting features from the original image data, analyzing the image format based on the extracted image features, and reading the image format information is as follows: S21: Divide the original image into M×M feature extraction regions; S22: for each pixel point in each of the feature extraction areas, obtaining pixels in the neighborhood of the pixel point, comparing the pixel point with the pixel value of a specified number of pixels in the neighborhood, marking the pixel point in the feature extraction area whose pixel value is greater than the pixel value of the central pixel point as 1, otherwise marking it as 0; S23: calculating the histogram of each feature extraction area and normalizing most of the histograms; S24: Connect the obtained histograms of the same level of each feature extraction area to form a feature vector of the original image, match the feature vector of the original image with the feature vectors of various image formats, and obtain the original image format according to the matching result.

4. The improved soft and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding according to claim 3 is characterized in that: The specific process of step S3 is as follows: S31: Calculate the total number of pixels of the original image by resolution*frame, and create a decoding output memory space according to the number of bits of storage space used for each pixel; S32: converting the original image into a YUV format, and performing discrete cosine transform on each of the M×M regions divided into the original image; S33: obtaining color component data of each region of the original image, reading the color component data stream until the read color component data stream is consistent with a leaf node of the Huffman tree, and using the Huffman tree to search for a weight corresponding to the leaf node; S34: Continue to read the bit data of the original image until the read-in component code is consistent with a leaf node of the Huffman tree of the component method and find the weight corresponding to the leaf node, and repeat the process of finding the weight until the preset end condition is met.

5. The improved soft and hard dual automatic error correction decoding method based on Ascend DVPP hard decoding according to claim 3 is characterized in that: The specific process of using the OpenCV library to perform soft decoding algorithm on the CPU side in step S4 is as follows: S41: extracting the original image in the original image format obtained in step S24, and obtaining the specified key parameters in the original image format; S42: Obtain pixel data of the original image, store the pixel data in a specified array according to specified key parameters, convert the original image into a grayscale image, and release resources.

Citation Information

Patent Citations

  • Display device and image display method thereof

    CN104113745A

  • Video decoding method and device

    CN113055744A

  • Video decoding method with combination of software and hardware and efficient transmission

    CN113596469A

  • Video decoding method and device, electronic equipment and medium

    CN116366865A

  • Automatic detection method and device for power line plug

    CN117853471A