diff options
Diffstat (limited to 'encoder/ih264e_bitstream.c')
-rw-r--r-- | encoder/ih264e_bitstream.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/encoder/ih264e_bitstream.c b/encoder/ih264e_bitstream.c index 9f73f69..dfdacff 100644 --- a/encoder/ih264e_bitstream.c +++ b/encoder/ih264e_bitstream.c @@ -30,13 +30,13 @@ * ittiam * * @par List of Functions: -* - ih264e_bitstrm_init() -* - ih264e_put_bits() -* - ih264e_put_bit() -* - ih264e_put_rbsp_trailing_bits() -* - ih264e_put_uev() -* - ih264e_put_sev() -* - ih264e_put_nal_start_code_prefix() +* - ih264e_bitstrm_init +* - ih264e_put_bits +* - ih264e_put_bit +* - ih264e_put_rbsp_trailing_bits +* - ih264e_put_uev +* - ih264e_put_sev +* - ih264e_put_nal_start_code_prefix * ****************************************************************************** */ @@ -45,7 +45,7 @@ /* File Includes */ /*****************************************************************************/ -/* System include files */ +/* System Include Files */ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -53,16 +53,17 @@ #include <stdarg.h> #include <math.h> -/* User include files */ +/* User Include Files */ #include "ih264e_config.h" #include "ih264_typedefs.h" -#include "ih264_platform_macros.h" + #include "ih264_debug.h" -#include "ih264e_error.h" -#include "ih264e_bitstream.h" -#include "ih264_defs.h" #include "ih264_macros.h" +#include "ih264_defs.h" +#include "ih264_platform_macros.h" +#include "ih264e_error.h" +#include "ih264e_bitstream.h" /*****************************************************************************/ /* Function Definitions */ @@ -182,7 +183,6 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm, /* 4. insert remaining bits of code starting from msb of cur word */ /* 5. update bitsleft in current word and stream buffer offset */ /********************************************************************/ - IH264E_ERROR_T status = IH264E_SUCCESS; WORD32 i, rem_bits = (code_len - bits_left_in_cw); /* insert parital code corresponding to bits left in cur word */ @@ -193,7 +193,8 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm, /* flush the bits in cur word byte by byte and copy to stream */ UWORD8 u1_next_byte = (u4_cur_word >> (i-8)) & 0xFF; - status |= ih264e_put_byte_epb(ps_bitstrm, u1_next_byte); + IH264E_ERROR_T status = ih264e_put_byte_epb(ps_bitstrm, u1_next_byte); + if (status != IH264E_SUCCESS) return status; } /* insert the remaining bits from code val into current word */ @@ -202,7 +203,7 @@ IH264E_ERROR_T ih264e_put_bits(bitstrm_t *ps_bitstrm, /* update the state variables and return success */ ps_bitstrm->u4_cur_word = u4_cur_word; ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE - rem_bits; - return (status); + return (IH264E_SUCCESS); } } @@ -262,7 +263,6 @@ IH264E_ERROR_T ih264e_put_rbsp_trailing_bits(bitstrm_t *ps_bitstrm) UWORD32 u4_cur_word = ps_bitstrm->u4_cur_word; WORD32 bits_left_in_cw = ps_bitstrm->i4_bits_left_in_cw; WORD32 bytes_left_in_cw = (bits_left_in_cw - 1) >> 3; - IH264E_ERROR_T status = IH264E_SUCCESS; /* insert a 1 at the end of current word and flush all the bits */ u4_cur_word |= (1 << (bits_left_in_cw - 1)); @@ -275,7 +275,8 @@ IH264E_ERROR_T ih264e_put_rbsp_trailing_bits(bitstrm_t *ps_bitstrm) /* flush the bits in cur word byte by byte and copy to stream */ UWORD8 u1_next_byte = (u4_cur_word >> (i-8)) & 0xFF; - status |= ih264e_put_byte_epb(ps_bitstrm, u1_next_byte); + IH264E_ERROR_T status = ih264e_put_byte_epb(ps_bitstrm, u1_next_byte); + if (status != IH264E_SUCCESS) return status; } /* Default init values for scratch variables of bitstream context */ @@ -283,7 +284,7 @@ IH264E_ERROR_T ih264e_put_rbsp_trailing_bits(bitstrm_t *ps_bitstrm) ps_bitstrm->i4_bits_left_in_cw = WORD_SIZE; ps_bitstrm->i4_zero_bytes_run = 0; - return (status); + return (IH264E_SUCCESS); } /** |