diff options
author | Lajos Molnar <lajos@google.com> | 2014-03-07 02:27:07 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-07 02:27:07 +0000 |
commit | 328ab3c21c185a7541e7ee087a61e18f6888af1c (patch) | |
tree | 22d3348bb938d3120e0565a29453dcfd7ccd407c | |
parent | e857b65c1d3aa055281cb48f59c9b5eb4a062dd0 (diff) | |
parent | 7eacea1156a3896ee7813cd9a06c535e63c95f6a (diff) | |
download | frameworks_av-328ab3c21c185a7541e7ee087a61e18f6888af1c.zip frameworks_av-328ab3c21c185a7541e7ee087a61e18f6888af1c.tar.gz frameworks_av-328ab3c21c185a7541e7ee087a61e18f6888af1c.tar.bz2 |
am 7eacea11: Merge "avcenc: Only do startcode escaping if the next byte requires it"
* commit '7eacea1156a3896ee7813cd9a06c535e63c95f6a':
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; - } } } |