nalu.c
资源名称:chapter15.rar [点击查看]
上传用户:hjq518
上传日期:2021-12-09
资源大小:5084k
文件大小:2k
源码类别:
Audio
开发平台:
Visual C++
- /*!
- ************************************************************************
- * file nalu.c
- *
- * brief
- * Common NALU support functions
- *
- * author
- * Main contributors (see contributors.h for copyright, address and affiliation details)
- * - Stephan Wenger <stewe@cs.tu-berlin.de>
- ************************************************************************
- */
- #include "global.h"
- #include "nalu.h"
- #include "nal.h"
- /*!
- *************************************************************************************
- * brief
- * Converts an RBSP to a NALU
- *
- * param rbsp
- * byte buffer with the rbsp
- * param nalu
- * nalu structure to be filled
- * param rbsp_size
- * size of the rbsp in bytes
- * param nal_unit_type
- * as in JVT doc
- * param nal_reference_idc
- * as in JVT doc
- * param min_num_bytes
- * some incomprehensible CABAC stuff
- * param UseAnnexbLongStartcode
- * when 1 and when using AnnexB bytestreams, then use a long startcode prefix
- *
- * return
- * length of the NALU in bytes
- *************************************************************************************
- */
- int RBSPtoNALU (unsigned char *rbsp, NALU_t *nalu, int rbsp_size, int nal_unit_type, int nal_reference_idc,
- int min_num_bytes, int UseAnnexbLongStartcode)
- {
- int len;
- assert (nalu != NULL);
- assert (nal_reference_idc <=3 && nal_reference_idc >=0);
- assert (nal_unit_type > 0 && nal_unit_type <= 10);
- assert (rbsp_size < MAXRBSPSIZE);
- nalu->startcodeprefix_len = UseAnnexbLongStartcode ? 4 : 3;
- nalu->forbidden_bit = 0;
- nalu->nal_reference_idc = (NalRefIdc) nal_reference_idc;
- nalu->nal_unit_type = (NaluType) nal_unit_type;
- len = RBSPtoEBSP (nalu->buf, rbsp, rbsp_size);
- nalu->len = len;
- return len;
- }