Video|视频编解码初步

字节 半字 字 双字 四字
x86: b w d q dq
mips: b h w d q
源码目录:
run-openh264/: 运行程序的脚本文件
openh264/: 我修改的
openh264-nomodify/: 未修改,直接用git clone http://cgit.loongnix.org/cgit/openh264 下载的。
25的服务器上:
scp -r run-openh264/ loongson@10.20.42.30:~
cd /home/build/
scp -r toolchain/ root@10.20.42.30:/opt/
本地机器上:
cd /opt/
mv toolchain/* .
tar -xf gdb.tar.gz
tar -xf gcc-4.8.3-1.loongson.3.tar.bz2
mv gcc-4.8.3-1.loongson.3 gcc-4.8.3
vim bash,将其内容拷贝到文件/etc/bashrc
source /etc/bashrc
which gcc
cd openh264-nomodify/
make -j4:编译
cp run-openh264/* .
./g.sh:运行,生成norc_noaq_nodenois_noscene8.264
md5sum norc_noaq_nodenois_noscene8.264 :生成校验码
ffplay norc_noaq_nodenois_noscene8.264
mplayer norc_noaq_nodenois_noscene8.264


提交:
git format-patch -1
patch -p1 < 0001-codec-processing-add-function-VAACalcSadSsd_mmi.patch
git push origin HEAD:refs/for/loongson-v1.5.3-Firefox39
git pull
git reset --hard 版本号
【Video|视频编解码初步】 readelf -h h264dec
make -B ENABLE64BIT=No BUILDTYPE=Release
调试:
gdb ./h264enc
r 参数
x/10i $pc
info reg
浅谈C/C++堆栈指引: http://blog.csdn.net/rainkin1993/article/details/8126237
社区源码库: http://gerrit.loongnix.org/
Gerrit系统使用帮助: http://10.2.5.21/showdoc/index.php/6
修改函数:
参考x86汇编:codec/processing/src/x86/vaa.asm中函数VAACalcSadBgd_sse2
编写mips汇编:codec/processing/src/vaacalc/vaacalculation.cpp中函数VAACalcSadBgd_mmi
对应的C源代码:codec/processing/src/vaacalc/vaacalcfuncs.cpp中函数VAACalcSadBgd_c
龙芯开源社区: http://www.loongnix.org/cgit
MMX指令集: http://blog.csdn.net/dahan_wangtao/article/details/1944153
SSE2指令集: http://blog.sina.com.cn/s/blog_54d5cd260100oduv.html
GCC在C语言中内嵌汇编 asm volatile : http://blog.csdn.net/pbymw8iwm/article/details/8227839


codec/encoder/core/src/deblocking.cpp
codec/common/x86/deblock.asm
codec/common/src/deblocking_common.cpp

long long f0=0,f2=0,f4=0,f6=0,f8=0,f10=0,f12=0,f14=0; long long f16=0,f18=0,f20=0,f22=0,f24=0,f26=0,f28=0,f30=0;


"dmfc1%[f0] , $f0\n\t" "dmfc1%[f2] , $f2\n\t" "dmfc1%[f4] , $f4\n\t" "dmfc1%[f6] , $f6\n\t" "dmfc1%[f8] , $f8\n\t" "dmfc1%[f10] , $f10\n\t" "dmfc1%[f12] , $f12\n\t" "dmfc1%[f14] , $f14\n\t" "dmfc1%[f16] , $f16\n\t" "dmfc1%[f18] , $f18\n\t" "dmfc1%[f20] , $f20\n\t" "dmfc1%[f22] , $f22\n\t" "dmfc1%[f24] , $f24\n\t" "dmfc1%[f26] , $f26\n\t" "dmfc1%[f28] , $f28\n\t" "dmfc1%[f30] , $f30\n\t"

:[pPixCb]"+&r"((unsigned char *)pPixCb), [pPixCr]"+&r"((unsigned char *)pPixCr), [f0]"=&r"(f0), [f2]"=&r"(f2), [f4]"=&r"(f4), [f6]"=&r"(f6), [f8]"=&r"(f8), [f10]"=&r"(f10), [f12]"=&r"(f12), [f14]"=&r"(f14), [f16]"=&r"(f16), [f18]"=&r"(f18), [f20]"=&r"(f20), [f22]"=&r"(f22), [f24]"=&r"(f24), [f26]"=&r"(f26), [f28]"=&r"(f28), [f30]"=&r"(f30) :[iStride]"r"((int)iStride), [iAlpha]"r"(iAlpha), [iBeta]"r"(iBeta), [pTC]"r"((unsigned char *)pTC), [tmp]"r"((unsigned char *)tmp) : "memory", "$8", "$9", "$10", "$11", "$12", "$13", "$15", "$f0", "$f2", "$f4", "$f6", "$f8", "$f10", "$f12", "$f14", "$f16", "$f18", "$f20", "$f22", "$f24", "$f26", "$f28", "$f30" );

printf("f0:%x\tf2:%x\tf4:%x\tf6:%x\tf8:%x\tf10:%x\tf12:%x\tf14:%x\n",f0,f2,f4,f6,f8,f10,f12,f14); printf("\n"); printf("f16:%x\tf18:%x\tf20:%x\tf22:%x\tf24:%x\tf26:%x\tf28:%x\tf30:%x\n",f16,f18,f20,f22,f24,f26,f28,f30); printf("\n");

asm volatile ( ".setarch=loongson3a\n\t"


    推荐阅读