H264 Decoder source code (Android 1.6)

Source: Internet
Author: User

Source code of the h264 decoder, port the h264 decoding part of FFMPEG to Android, perform in-depth deletion optimization, and pass the verification in the simulator (320x480.

ProgramJNI architecture. The interface, file reading, and video display are all made in Java. The underlying video decoding uses C to meet the speed requirements.

In this version, the nal is split from the h264 code stream at the Java layer, so that when the Java layer calls decoding directly, it will know whether there is a video to be displayed, the disadvantage is that coupling/encapsulation is poor.

If the nal splitting method is used at the underlying layer, it can be well-formed, but the data sent each time is limited. If too much data is sent, the underlying layer may decode several frames of video at a time, however, only one frame can be displayed at the interface layer, resulting in Frame loss. If less data is sent each time, there will be many underlying calls without substantial decoding, which is very stingy. For example, a compressed data frame requires 600 bytes, if 100 bytes are sent to the decoder at a time, the actual decoding is performed only six times. Because each data frame has a large and small size, the minimum value can be used to avoid Frame loss.

However, all encoding and decoding are the results of balancing various factors. The specific method is used for specific analysis.

Note that the size of the video written to the decoding database is 240x320. For other videos, you must modify the underlying video size.Code.

 

Decoding source code: http://mcodec.cnblogs.com/files/mcodec/H264Android.rar

Test code stream: http://mcodec.cnblogs.com/files/mcodec/butterfly.h264.rar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.