www.pudn.com > T264-src-0.02.zip > rbsp.h


/***************************************************************************** 
 * 
 *  T264 AVC CODEC 
 * 
 *  Copyright(C) 2004-2005 llcc  
 *               2004-2005 visionany  
 * 
 *  This program is free software ; you can redistribute it and/or modify 
 *  it under the terms of the GNU General Public License as published by 
 *  the Free Software Foundation ; either version 2 of the License, or 
 *  (at your option) any later version. 
 * 
 *  This program is distributed in the hope that it will be useful, 
 *  but WITHOUT ANY WARRANTY ; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU General Public License for more details. 
 * 
 *  You should have received a copy of the GNU General Public License 
 *  along with this program ; if not, write to the Free Software 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
 * 
 ****************************************************************************/ 
 
#ifndef _RBSP_H_ 
#define _RBSP_H_ 
 
enum 
{ 
    NAL_SLICE_NOPART = 1, 
    NAL_SLICE_PARTA, 
    NAL_SLICE_PARTB, 
    NAL_SLICE_PARTC, 
    NAL_SLICE_IDR, 
    NAL_SEI, 
    NAL_SEQ_SET, 
    NAL_PIC_SET, 
    NAL_ACD, 
    NAL_END_SEQ, 
    NAL_END_STREAM, 
    NAL_FILTER 
}; 
// 
// nal_unit 
// 
typedef struct 
{ 
    int32_t nal_ref_idc; 
    int32_t nal_unit_type; 
    int32_t nal_size; 
} T264_nal_t; 
 
typedef struct 
{ 
    int32_t profile_idc; 
    int32_t level_idc; 
    int32_t seq_id; 
    int32_t log2_max_frame_num_minus4; 
    int32_t pic_order_cnt_type; 
    int32_t max_pic_order; 
    int32_t num_ref_frames; 
    int32_t pic_width_in_mbs_minus1; 
    int32_t pic_height_in_mbs_minus1; 
    int32_t frame_mbs_only_flag; 
} T264_seq_set_t; 
 
typedef struct 
{ 
    int32_t pic_id; 
    int32_t seq_id; 
    int32_t entroy_coding_mode_flag; 
    int32_t pic_order_present_flag; 
    int32_t num_slice_groups_minus1; 
    int32_t num_ref_idx_l0_active_minus1; 
    int32_t num_ref_idx_l1_active_minus1; 
    int32_t weighted_pred_flag; 
    int32_t weighted_bipred_idc; 
    int32_t pic_init_qp_minus26; 
    int32_t pic_init_qs_minus26; 
    int32_t chroma_qp_index_offset; 
    int32_t deblocking_filter_control_present_flag; 
} T264_pic_set_t; 
 
typedef struct 
{ 
    int32_t first_mb_in_slice; 
    int32_t slice_type; 
    int32_t pic_id; 
    int32_t frame_num; 
    int32_t idr_pic_id; 
    /* pic_oder_cnt_type == 0*/ 
    int32_t pic_order_cnt_lsb; 
    int32_t delta_pic_order_cnt_bottom; 
    /*P frame*/ 
    int32_t num_ref_idx_active_override_flag; 
    int32_t slice_qp_delta; 
    int32_t ref_pic_list_reordering_flag_l0; 
    int32_t no_output_of_prior_pics_flag; 
    int32_t long_term_reference_flag; 
    int32_t adaptive_ref_pic_marking_mode_flag; 
} T264_slice_t; 
 
typedef struct T264_t T264_t; 
 
void nal_unit_init(_RW T264_nal_t* nal, int32_t nal_ref_idc, int32_t nal_unit_type); 
void nal_unit_write(_R T264_t* t, _R T264_nal_t* nal); 
void seq_set_init(_R T264_t* t, _RW T264_seq_set_t* seq); 
void seq_set_write(_R T264_t* t, _RW T264_seq_set_t* seq); 
void pic_set_init(_R T264_t* t, _RW T264_pic_set_t* pic); 
void pic_set_write(_R T264_t* t, _RW T264_pic_set_t* pic); 
void slice_header_init(_R T264_t* t, _RW T264_slice_t* slice); 
void slice_header_write(_R T264_t* t, _RW T264_slice_t* slice); 
void rbsp_trailing_bits(_R T264_t* t); 
 
#endif