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