2015-03-13 21:24:58 +05:30
|
|
|
/******************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2015 The Android Open Source Project
|
|
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************
|
|
|
|
|
* Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* @file
|
|
|
|
|
* ih264e_encode_header.h
|
|
|
|
|
*
|
|
|
|
|
* @brief
|
|
|
|
|
* This file contains structures and interface prototypes for h264 bitstream
|
|
|
|
|
* header encoding
|
|
|
|
|
*
|
|
|
|
|
* @author
|
|
|
|
|
* ittiam
|
|
|
|
|
*
|
|
|
|
|
* @remarks
|
2023-09-30 01:19:52 +05:30
|
|
|
* none
|
2015-03-13 21:24:58 +05:30
|
|
|
*
|
|
|
|
|
*******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
#ifndef _IH264E_ENCODE_HEADER_H_
|
|
|
|
|
#define _IH264E_ENCODE_HEADER_H_
|
2015-03-13 21:24:58 +05:30
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Function Macros */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* @brief Macro to put a code with specified number of bits into the
|
|
|
|
|
* bitstream
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
2019-10-11 18:53:50 +05:30
|
|
|
#define PUT_BITS(ps_bitstrm, code_val, code_len, ret_val, syntax_string) \
|
|
|
|
|
{ \
|
|
|
|
|
ENTROPY_TRACE(syntax_string, code_val); \
|
|
|
|
|
ret_val = ih264e_put_bits((ps_bitstrm), (code_val), (code_len)); \
|
|
|
|
|
if(ret_val != IH264E_SUCCESS) \
|
|
|
|
|
{ \
|
|
|
|
|
return ret_val; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2015-03-13 21:24:58 +05:30
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* @brief Macro to put a code with specified number of bits into the
|
|
|
|
|
* bitstream using 0th order exponential Golomb encoding for
|
|
|
|
|
* signed numbers
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
2019-10-11 18:53:50 +05:30
|
|
|
#define PUT_BITS_UEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
|
|
|
|
{ \
|
|
|
|
|
ENTROPY_TRACE(syntax_string, code_val); \
|
|
|
|
|
ret_val = ih264e_put_uev((ps_bitstrm), (code_val)); \
|
|
|
|
|
if(ret_val != IH264E_SUCCESS) \
|
|
|
|
|
{ \
|
|
|
|
|
return ret_val; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2015-03-13 21:24:58 +05:30
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* @brief Macro to put a code with specified number of bits into the
|
|
|
|
|
* bitstream using 0th order exponential Golomb encoding for
|
|
|
|
|
* signed numbers
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
2019-10-11 18:53:50 +05:30
|
|
|
#define PUT_BITS_SEV(ps_bitstrm, code_val, ret_val, syntax_string) \
|
|
|
|
|
{ \
|
|
|
|
|
ENTROPY_TRACE(syntax_string, code_val); \
|
|
|
|
|
ret_val = ih264e_put_sev((ps_bitstrm), (code_val)); \
|
|
|
|
|
if(ret_val != IH264E_SUCCESS) \
|
|
|
|
|
{ \
|
|
|
|
|
return ret_val; \
|
|
|
|
|
} \
|
|
|
|
|
}
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2019-11-27 13:52:47 +05:30
|
|
|
/**
|
|
|
|
|
******************************************************************************
|
|
|
|
|
* @brief Macro to set active entropy threads to zero and return
|
|
|
|
|
* in case of errors
|
|
|
|
|
******************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
#define RETURN_ENTROPY_IF_ERROR(ps_codec, ps_entropy, ctxt_sel) \
|
|
|
|
|
if(ps_entropy->i4_error_code != IH264E_SUCCESS) \
|
|
|
|
|
{ \
|
|
|
|
|
DATA_SYNC(); \
|
|
|
|
|
return ps_entropy->i4_error_code; \
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-13 21:24:58 +05:30
|
|
|
/*****************************************************************************/
|
2023-09-30 01:19:52 +05:30
|
|
|
/* Function Declarations */
|
2015-03-13 21:24:58 +05:30
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
WORD32 ih264e_generate_sps(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t *ps_vui);
|
2019-10-01 11:59:43 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
WORD32 ih264e_generate_pps(bitstrm_t *ps_bitstrm, pps_t *ps_pps, sps_t *ps_sps);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
IH264E_ERROR_T ih264e_generate_sei(bitstrm_t *ps_bitstrm,
|
|
|
|
|
sei_params_t *ps_sei,
|
|
|
|
|
UWORD32 u4_insert_per_idr);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
WORD32 ih264e_generate_slice_header(bitstrm_t *ps_bitstrm,
|
|
|
|
|
slice_header_t *ps_slice_hdr,
|
|
|
|
|
pps_t *ps_pps,
|
|
|
|
|
sps_t *ps_sps);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
IH264E_ERROR_T ih264e_populate_sps(codec_t *ps_codec, sps_t *ps_sps);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
IH264E_ERROR_T ih264e_populate_pps(codec_t *ps_codec, pps_t *ps_pps);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
WORD32 ih264e_populate_slice_header(process_ctxt_t *ps_proc,
|
|
|
|
|
slice_header_t *ps_slice_hdr,
|
|
|
|
|
pps_t *ps_pps,
|
|
|
|
|
sps_t *ps_sps);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
IH264E_ERROR_T ih264e_add_filler_nal_unit(bitstrm_t *ps_bitstrm,
|
|
|
|
|
WORD32 insert_fill_bytes);
|
2015-03-13 21:24:58 +05:30
|
|
|
|
|
|
|
|
|
2023-09-30 01:19:52 +05:30
|
|
|
#endif /* _IH264E_ENCODE_HEADER_H_ */
|