diff options
author | Lajos Molnar <lajos@google.com> | 2014-02-11 21:52:33 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-02-11 21:52:33 +0000 |
commit | 880c6b2dd8b2fe2ab0054e74bbc108d322e82aa0 (patch) | |
tree | 7a0fe12f9fab8433f5fb107f99bcf2886d043de9 | |
parent | 4ef5d8f038588080b73790a46a45d710a6a1d977 (diff) | |
parent | 1c178d3e7b8d037ac8d348922ba841b28eee662f (diff) | |
download | frameworks_av-880c6b2dd8b2fe2ab0054e74bbc108d322e82aa0.zip frameworks_av-880c6b2dd8b2fe2ab0054e74bbc108d322e82aa0.tar.gz frameworks_av-880c6b2dd8b2fe2ab0054e74bbc108d322e82aa0.tar.bz2 |
am 1c178d3e: am 7eacea11: Merge "avcenc: Only do startcode escaping if the next byte requires it"
* commit '1c178d3e7b8d037ac8d348922ba841b28eee662f':
avcenc: Only do startcode escaping if the next byte requires it
-rw-r--r-- | media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp index 0e3037f..d71c327 100644 --- a/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp +++ b/media/libstagefright/codecs/avc/enc/src/bitstream_io.cpp @@ -103,6 +103,15 @@ AVCEnc_Status AVCBitstreamSaveWord(AVCEncBitstream *stream) { num_bits -= 8; byte = (current_word >> num_bits) & 0xFF; + if (stream->count_zeros == 2) + { /* for num_bits = 32, this can add 2 more bytes extra for EPBS */ + if (byte <= 3) + { + *write_pnt++ = 0x3; + stream->write_pos++; + stream->count_zeros = 0; + } + } if (byte != 0) { *write_pnt++ = byte; @@ -114,12 +123,6 @@ AVCEnc_Status AVCBitstreamSaveWord(AVCEncBitstream *stream) stream->count_zeros++; *write_pnt++ = byte; stream->write_pos++; - if (stream->count_zeros == 2) - { /* for num_bits = 32, this can add 2 more bytes extra for EPBS */ - *write_pnt++ = 0x3; - stream->write_pos++; - stream->count_zeros = 0; - } } } |