C++ 有没有人能用C++;?

C++ 有没有人能用C++;?,c++,parsing,video,h.264,C++,Parsing,Video,H.264,尝试解码H.264视频流的SDP sprop参数集值,并发现访问某些值将涉及对Exp Golomb编码数据的解析,我的方法包含字节数组中的base64解码sprop参数集数据,我现在对其进行位遍历,但已达到Exp Golomb编码数据的第一部分,并且寻找一个合适的代码提取来解析这些值。< P>我写了一个使用GOOLB代码的C++ JPEG LS压缩库。我不知道Exp Golomb代码是否完全相同。该库是开源的,请访问。我使用查找表来解码golomb代码Exp.-golomb代码的顺序是什么??

尝试解码H.264视频流的SDP sprop参数集值,并发现访问某些值将涉及对Exp Golomb编码数据的解析,我的方法包含字节数组中的base64解码sprop参数集数据,我现在对其进行位遍历,但已达到Exp Golomb编码数据的第一部分,并且寻找一个合适的代码提取来解析这些值。

< P>我写了一个使用GOOLB代码的C++ JPEG LS压缩库。我不知道Exp Golomb代码是否完全相同。该库是开源的,请访问。我使用查找表来解码golomb代码Exp.-golomb代码的顺序是什么?? 如果您需要解析H.264位流(我指的是传输层),您可以编写一个简单的函数来访问无限位流中的指定位。从左到右的位索引

inline u_dword get_bit(const u_byte * const base, u_dword offset)
{
    return ((*(base + (offset >> 0x3))) >> (0x7 - (offset & 0x7))) & 0x1;
}
此函数实现零范围exp Golomb代码的解码(用于H.264)

u_dword DECOUGOLOMB(常量u_字节*常量基,u_dword*常量偏移)
{
u_dword零=0;
//计算零位。将进行优化。
而(0==get_位(基,(*偏移量)++)零++;
//插入第一个1位
u_dword info=1=0;i--)
{

info |=get_bit(base,(*offset)++)通过一个函数进行修改,以从流中获取N位;用于解析H.264 NAL

inline uint32_t get_bit(const uint8_t * const base, uint32_t offset)
{
    return ((*(base + (offset >> 0x3))) >> (0x7 - (offset & 0x7))) & 0x1;
}

inline uint32_t get_bits(const uint8_t * const base, uint32_t * const offset, uint8_t bits)
{
    uint32_t value = 0;
    for (int i = 0; i < bits; i++)
    {
      value = (value << 1) | (get_bit(base, (*offset)++) ? 1 : 0);
    }
    return value;
}

// This function implement decoding of exp-Golomb codes of zero range (used in H.264).

uint32_t DecodeUGolomb(const uint8_t * const base, uint32_t * const offset)
{
    uint32_t zeros = 0;

    // calculate zero bits. Will be optimized.
    while (0 == get_bit(base, (*offset)++)) zeros++;

    // insert first 1 bit
    uint32_t info = 1 << zeros;

    for (int32_t i = zeros - 1; i >= 0; i--)
    {
        info |= get_bit(base, (*offset)++) << i;
    }

    return (info - 1);
}
内联uint32获取位(常量uint8*const base,uint32偏移量)
{
返回((*(基+(偏移量>>0x3)))>>(0x7-(偏移量&0x7)))和0x1;
}
内联uint32获取位(常量uint8*const基、uint32*const偏移、uint8\U t位)
{
uint32_t值=0;
for(int i=0;ivalue=(value接受的答案不是正确的实现。它给出了错误的输出。请根据

“第9.1节Exp Golomb代码解析过程”规范T-REC-H.264-201304

int32_t getBitByPos(无符号字符*缓冲区,int32_t pos){
返回(缓冲区[pos/8]>>(8-pos%8)&0x01);
}
uint32_t decodeGolomb(无符号字符*字节流,uint32_t*索引){
uint32_t前导零位=-1;
uint32_t codeNum=0;
uint32_t pos=*索引;
if(byteStream==NULL | | pos==0){
printf(“无效输入\n”);
返回0;
}
对于(int32_t b=0;!b;前导零位++)
b=getBitByPos(ByTestStream,pos++);
对于(int32_t b=前导零位;b>0;b--)

codeNum=codeNum |(getBitByPos(byteStream,pos++)你从哪里找到了sprop参数集中包含的内容?!我正在搜索互联网,但没有结果…=|你能给我一个文档链接吗?!我对解码视频大小感兴趣…ThnHey我发现:关于sprop参数集的内容,我必须参考以下文档ISO/IEC 14496-10:2005,我担心您必须付费。第7.3.2.1节。您所需的规范可从ITU网站免费下载:-选择可免费下载的PDF,您将在第7.3.2.1.1节中找到详细的格式。抱歉,我之前的回答并不迟钝,只是不知道该信息在公共领域可用。它被称为“顺序”,而不是“范围”,可能是几年前的事了。对不起!我知道这篇文章很旧,但我只想说这是我见过的最优雅的ExpGolomb解码实现!我向你致敬T0K3N1 Z3R!!!我很高兴它有用)错误:删除“u_dword info…”之后的空白(*偏移量)++。否则,它会吃掉太多位,并抛出所有后续解码。
inline uint32_t get_bit(const uint8_t * const base, uint32_t offset)
{
    return ((*(base + (offset >> 0x3))) >> (0x7 - (offset & 0x7))) & 0x1;
}

inline uint32_t get_bits(const uint8_t * const base, uint32_t * const offset, uint8_t bits)
{
    uint32_t value = 0;
    for (int i = 0; i < bits; i++)
    {
      value = (value << 1) | (get_bit(base, (*offset)++) ? 1 : 0);
    }
    return value;
}

// This function implement decoding of exp-Golomb codes of zero range (used in H.264).

uint32_t DecodeUGolomb(const uint8_t * const base, uint32_t * const offset)
{
    uint32_t zeros = 0;

    // calculate zero bits. Will be optimized.
    while (0 == get_bit(base, (*offset)++)) zeros++;

    // insert first 1 bit
    uint32_t info = 1 << zeros;

    for (int32_t i = zeros - 1; i >= 0; i--)
    {
        info |= get_bit(base, (*offset)++) << i;
    }

    return (info - 1);
}
int32_t getBitByPos(unsigned char *buffer, int32_t pos) {
    return (buffer[pos/8] >> (8 - pos%8) & 0x01);
}


uint32_t decodeGolomb(unsigned char *byteStream, uint32_t *index) {
    uint32_t leadingZeroBits = -1;
    uint32_t codeNum = 0;
    uint32_t pos = *index;

    if (byteStream == NULL || pos == 0 ) {
        printf("Invalid input\n");
        return 0;
    }

    for (int32_t b = 0; !b; leadingZeroBits++)
        b = getBitByPos(byteStream, pos++);

    for (int32_t b = leadingZeroBits; b > 0; b--)
        codeNum = codeNum | (getBitByPos(byteStream, pos++) << (b - 1));

    *index = pos;
    return ((1 << leadingZeroBits) - 1 + codeNum);
}