1 Star 0 Fork 0

wangzhankun/untrunc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
codec_camm.cpp 988 Bytes
一键复制 编辑 原始数据 按行查看 历史
#include "codec.h"
//https://developers.google.com/streetview/publish/camm-spec
//TODO could tell from the working sample which types are used.
#include <set>
#include <iostream>
using namespace std;
Match Codec::cammMatch(const unsigned char *start, int maxlength) {
Match match;
int lengths[] = { 12, 8, 12, 12, 12, 24, 14*4, 12 };
while(start[0] == 0 && start[1] == 0 || start[3] == 0 && start[2] < 7) {
int type = start[2];
match.chances = 1<<20;
int len = lengths[type] + 4;
match.length += len;
start += len;
if(match.length > maxlength - 15*4)
break;
}
return match;
}
Match Codec::cammSearch(const unsigned char *start, int maxlength) {
Match match;
const unsigned char *end = start + maxlength - 8;
const unsigned char *current = start;
while(current < end) {
if(start[0] == 0 && start[1] == 0 || start[3] == 0 && start[2] < 7) {
match.chances = 1<<20;
match.offset = current - start;
return match;
}
current++;
}
return match;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangzhankun/untrunc.git
git@gitee.com:wangzhankun/untrunc.git
wangzhankun
untrunc
untrunc
master

搜索帮助