#include "momusys.h"
#include "vlc.h"
#include "putvlc.h"
#include "bitstream.h"
Int
PutDCsize_lum (Int size, Image *bitstream)
{
MOMCHECK(size >= 0 && size < 13);
BitstreamPutBits (bitstream, DCtab_lum[size].code, DCtab_lum[size].len);
return DCtab_lum[size].len;
}
Int
PutDCsize_chrom (Int size, Image *bitstream)
{
MOMCHECK (size >= 0 && size < 13);
BitstreamPutBits (bitstream, DCtab_chrom[size].code, DCtab_chrom[size].len);
return DCtab_chrom[size].len;
}
Int
PutMV (Int mvint, Image *bitstream)
{
Int sign = 0;
Int absmv;
if (mvint > 32)
{
absmv = -mvint + 65;
sign = 1;
}
else
absmv = mvint;
BitstreamPutBits (bitstream, mvtab[absmv].code, mvtab[absmv].len);
if (mvint != 0)
{
BitstreamPutBits (bitstream, sign, 1);
return mvtab[absmv].len + 1;
}
else
return mvtab[absmv].len;
}
Int
PutMCBPC_Intra (Int cbpc, Int mode, Image *bitstream)
{
Int ind;
ind = ((mode >> 1) & 3) | ((cbpc & 3) << 2);
BitstreamPutBits (bitstream, mcbpc_intra_tab[ind].code, mcbpc_intra_tab[ind].len);
return mcbpc_intra_tab[ind].len;
}
Int
PutMCBPC_Inter (Int cbpc, Int mode, Image *bitstream)
{
Int ind;
ind = (mode & 7) | ((cbpc & 3) << 3);
BitstreamPutBits (bitstream, mcbpc_inter_tab[ind].code,
mcbpc_inter_tab[ind].len);
return mcbpc_inter_tab[ind].len;
}
Int
PutMCBPC_Sprite (Int cbpc, Int mode, Image *bitstream)
{
Int ind;
ind = (mode & 7) | ((cbpc & 3) << 3);
BitstreamPutBits (bitstream, mcbpc_sprite_tab[ind].code,
mcbpc_sprite_tab[ind].len);
return mcbpc_sprite_tab[ind].len;
}
Int
PutCBPY (Int cbpy, Char intra, Int *MB_transp_pattern, Image *bitstream)
{
Int ind;
Int index=0;
if (intra == 0) cbpy = 15 - cbpy;
ind = cbpy;
BitstreamPutBits (bitstream, cbpy_tab[ind].code, cbpy_tab[ind].len);
return cbpy_tab[ind].len;
}
Int
PutCoeff_Inter(Int run, Int level, Int last, Image *bitstream)
{
Int length = 0;
MOMCHECK (last >= 0 && last < 2);
MOMCHECK (run >= 0 && run < 64);
MOMCHECK (level > 0 && level < 128);
if (last == 0)
{
if (run < 2 && level < 13 )
{
BitstreamPutBits (bitstream, (LInt)coeff_tab0[run][level-1].code,
(LInt)coeff_tab0[run][level-1].len);
length = coeff_tab0[run][level-1].len;
}
else if (run > 1 && run < 27 && level < 5)
{
BitstreamPutBits (bitstream, (LInt)coeff_tab1[run-2][level-1].code,
(LInt)coeff_tab1[run-2][level-1].len);
length = coeff_tab1[run-2][level-1].len;
}
}
else if (last == 1)
{
if (run < 2 && level < 4)
{
BitstreamPutBits (bitstream, (LInt)coeff_tab2[run][level-1].code,
(LInt)coeff_tab2[run][level-1].len);
length = coeff_tab2[run][level-1].len;
}
else if (run > 1 && run < 42 && level == 1)
{
BitstreamPutBits (bitstream, (LInt)coeff_tab3[run-2].code,
(LInt)coeff_tab3[run-2].len);
length = coeff_tab3[run-2].len;
}
}
return length;
}
Int
PutCoeff_Intra(Int run, Int level, Int last, Image *bitstream)
{
Int length = 0;
MOMCHECK (last >= 0 && last < 2);
MOMCHECK (run >= 0 && run < 64);
MOMCHECK (level > 0 && level < 128);
if (last == 0)
{
if (run == 0 && level < 28 )
{
BitstreamPutBits(bitstream, (LInt)coeff_tab4[level-1].code,
(LInt)coeff_tab4[level-1].len);
length = coeff_tab4[level-1].len;
}
else if (run == 1 && level < 11)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab5[level-1].code,
(LInt)coeff_tab5[level-1].len);
length = coeff_tab5[level-1].len;
}
else if (run > 1 && run < 10 && level < 6)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab6[run-2][level-1].code,
(LInt)coeff_tab6[run-2][level-1].len);
length = coeff_tab6[run-2][level-1].len;
}
else if (run > 9 && run < 15 && level == 1)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab7[run-10].code,
(LInt)coeff_tab7[run-10].len);
length = coeff_tab7[run-10].len;
}
}
else if (last == 1)
{
if (run == 0 && level < 9)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab8[level-1].code,
(LInt)coeff_tab8[level-1].len);
length = coeff_tab8[level-1].len;
}
else if (run > 0 && run < 7 && level < 4)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab9[run-1][level-1].code,
(LInt)coeff_tab9[run-1][level-1].len);
length = coeff_tab9[run-1][level-1].len;
}
else if (run > 6 && run < 21 && level == 1)
{
BitstreamPutBits(bitstream, (LInt)coeff_tab10[run-7].code,
(LInt)coeff_tab10[run-7].len);
length = coeff_tab10[run-7].len;
}
}
return length;
}
Int
PutCoeff_Inter_RVLC(Int run, Int level, Int last, Image *bitstream)
{
Int length = 0;
MOMCHECK (last >= 0 && last < 2);
MOMCHECK (run >= 0 && run < 64);
MOMCHECK (level > 0 && level < 128);
if (last == 0)
{
if (run == 0 && level < 20 )
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab14[level-1].code,
(LInt)coeff_RVLCtab14[level-1].len);
length = coeff_RVLCtab14[level-1].len;
}
else if (run == 1 && level < 11)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab15[level-1].code,
(LInt)coeff_RVLCtab15[level-1].len);
length = coeff_RVLCtab15[level-1].len;
}
else if (run > 1 && run < 4 && level < 8)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab16[run-2][level-1].code,
(LInt)coeff_RVLCtab16[run-2][level-1].len);
length = coeff_RVLCtab16[run-2][level-1].len;
}
else if (run == 4 && level < 6)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab17[level-1].code,
(LInt)coeff_RVLCtab17[level-1].len);
length = coeff_RVLCtab17[level-1].len;
}
else if (run > 4 && run < 8 && level < 5)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab18[run-5][level-1].code,
(LInt)coeff_RVLCtab18[run-5][level-1].len);
length = coeff_RVLCtab18[run-5][level-1].len;
}
else if (run > 7 && run < 10 && level < 4)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab19[run-8][level-1].code,
(LInt)coeff_RVLCtab19[run-8][level-1].len);
length = coeff_RVLCtab19[run-8][level-1].len;
}
else if (run > 9 && run < 18 && level < 3)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab20[run-10][level-1].code,
(LInt)coeff_RVLCtab20[run-10][level-1].len);
length = coeff_RVLCtab20[run-10][level-1].len;
}
else if (run > 17 && run < 39 && level == 1)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab21[run-18].code,
(LInt)coeff_RVLCtab21[run-18].len);
length = coeff_RVLCtab21[run-18].len;
}
}
else if (last == 1)
{
if (run >= 0 && run < 2 && level < 6)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab22[run][level-1].code,
(LInt)coeff_RVLCtab22[run][level-1].len);
length = coeff_RVLCtab22[run][level-1].len;
}
else if (run == 2 && level < 4)
{
BitstreamPutBits (bitstream, (LInt)coeff_RVLCtab23[level-1].code,
(LInt)coeff_RVLCtab23[level-1].len);
length = coeff_RVLCtab23[level-1].len;
}
else if (run > 2 && run < 14 && level < 3)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab24[run-3][level-1].code,
(LInt)coeff_RVLCtab24[run-3][level-1].len);
length = coeff_RVLCtab24[run-3][level-1].len;
}
else if (run > 13 && run < 46 && level == 1)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab25[run-14].code,
(LInt)coeff_RVLCtab25[run-14].len);
length = coeff_RVLCtab25[run-14].len;
}
}
return length;
}
Int
PutCoeff_Intra_RVLC(Int run, Int level, Int last, Image *bitstream)
{
Int length = 0;
MOMCHECK (last >= 0 && last < 2);
MOMCHECK (run >= 0 && run < 64);
MOMCHECK (level > 0 && level < 128);
if (last == 0)
{
if (run == 0 && level < 28 )
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab1[level-1].code,
(LInt)coeff_RVLCtab1[level-1].len);
length = coeff_RVLCtab1[level-1].len;
}
else if (run == 1 && level < 14)
{
BitstreamPutBits(bitstream, (LInt)coeff_RVLCtab2[level-1].code,
(LInt)coeff_RVLCtab2[level-1].len);
l
没有合适的资源?快使用搜索试试~ 我知道了~
MPEG-4编码技术 源码
共53个文件
h:24个
c:17个
entries:2个
5星 · 超过95%的资源 需积分: 10 8 下载量 194 浏览量
2009-08-18
23:06:38
上传
评论
收藏 145KB RAR 举报
温馨提示
//All rights reserved for the original author //PROHIBIT to use it for commercial purpose (1)本程序可在Windows 2000、Visual C++6.0 环境下编译通过。 (2)源码是一个编码模块,编译后生成encore.lib库文件, 不能直接执行。需要读者自己编写程序调用其中的功能。
资源推荐
资源详情
资源评论
收起资源包目录
MPEG-4编码技术.rar (53个子文件)
MPEG-4编码技术
encore
src
text_dct.h 166B
max_level.h 2KB
putvlc.c 19KB
text_dct.c 3KB
bitstream.c 1KB
text_code_mb.h 361B
intel_mmx
text_fdct_mmx.c 13KB
CVS
Entries 109B
Repository 31B
Root 51B
text_idct_mmx.c 12KB
mot_est_mb.c 15KB
mom_structs.h 1KB
mom_access.h 3KB
rate_ctl.c 3KB
putvlc.h 1KB
text_defs.h 391B
mot_est_comp.c 12KB
encore.h 780B
mom_util.h 1KB
mot_code.h 403B
encore.c 9KB
mot_est_mb.h 848B
zigzag.h 1KB
rate_ctl.h 321B
vop_code.h 558B
vlc.h 15KB
mot_util.h 1KB
bitstream.h 397B
mot_est_comp.h 391B
mot_util.c 6KB
text_code.c 18KB
vm_enc_defs.h 616B
text_bits.c 15KB
text_code.h 609B
text_code_mb.c 7KB
mom_util.c 6KB
text_bits.h 1KB
vm_common_defs.h 3KB
mot_code.c 9KB
non_unix.h 273B
mom_access.c 6KB
vop_code.c 6KB
momusys.h 6KB
build
win32
CVS
Entries 95B
Repository 29B
Root 51B
encore.plg 8KB
encore.opt 48KB
encore.dsp 6KB
Debug
encore.lib 282KB
encore.ncb 105KB
encore.dsw 534B
共 53 条
- 1
资源评论
- zgqdxxf2012-02-02资源不错,就是要分太高。http://download.csdn.net/download/mxp1985/1303489 这个链接是相同的资源,只要3分。
onezeros
- 粉丝: 1087
- 资源: 211
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功