随笔分类 -  Video Encoding

摘要:想当然了,用递归实现DCT,没想到DCT有4个分支需要递归下去,这样的规模非但无法快速实现,反而由于本身时间复杂度没有多大减少加上递归开销等等比慢速实现往往还慢。这个代码片段将由于清洁需要从QSharp中删除而保留在这里,对其分析将在代码之后有空时进行。过两天想想是不是能用动态规划或备忘录来改进这个算法。 1 /// <summary> 2 /// Type-IV DCT implemented using recursive method 3 /// Warning: This method is mathematically crippled even slower than 阅读全文
posted @ 2013-03-26 00:36 quanben 阅读(290) 评论(0) 推荐(0)
摘要:Steve Jobs passed away just a few hours ago, and this is really a saddening news. One thought that comes to my mind is the consequence of this might be as much as an non-neglibgle factor that would worsen the situation of IT industry and even cast a shadow to the already gloomy global economy.I pers 阅读全文
posted @ 2011-10-06 18:38 quanben 阅读(181) 评论(0) 推荐(0)
摘要:以下是最近热议的新开源的Quake III源码中的一段tricky code,我稍作修改后如下:float CarmackInvSqrt(float x, unsigned long magicNumber){ float xhalf = 0.5f*x; int i = *(int*)&x; // get bits for floating VALUE i = magicNumber - (i>>1); // gives initial guess y0 x = *(float*)&i; // convert bits BA... 阅读全文
posted @ 2010-10-08 12:44 quanben 阅读(206) 评论(0) 推荐(0)
摘要:通过SDK/NDK构建的基于本地功能的程序能够比较方便地迁移到实际的运行平台上。一般对于SDK-eclipxe创建的JAVA应用程序,可以将整个工程目录复制到文件系统源码的development/samples之下,和SDK的一些例程放在一起,虽然不是最符合规范,但比较方便,基本不需要对mk文件进行任何配置和改变。对于本地程序,NDK开发环境只提供了一些基本的C/C++库的支持,因此只适合简单功能模块的SDK/NDK联调或写一些stubs。对需要应用到更多的底层功能情形,应考虑直接在文件系统源码中直接开发本地程序,只要最终对JNI的入口是位于unix/linux体系的Shared Librar 阅读全文
posted @ 2010-03-09 09:43 quanben 阅读(157) 评论(0) 推荐(0)
摘要:总的来说ANDROID的NDK远不及其应用开发的SDK完善(虽然经过一番不算复杂的折腾发现NDK用起来很方便),而且它本身也不推荐使用这种做法,至少目前也不将此作为重点。但是某些中间层面系统测试(主要如多媒体和OpenGL ES的测试和演示等)必须通过本地代码实现,因此NDK应当是必由之路。 最近尝试了一下,目前将JNI部分基本理顺(而后续则需要链接相关的ANDROID本地库,如OpenCore系统)。 网上这方面相关介绍也有不少,但是多不太完整,此处权作工作记录。 1 NDK使用 1.1 配置NDK 本处讨论在Windows下使用cygwin处理NDK的Windows版本。Linux下的使用 阅读全文
posted @ 2010-02-02 12:57 quanben 阅读(211) 评论(0) 推荐(0)
摘要:从一个实际的小问题出发,回顾一些基础的知识点:平稳噪声x[n]激励系统h[n],输出y[n]能量需要和x[n]一致,系统的形式: AH(z) = -------------------------- 1 - sum(i=1:m, a[i]h[i])求A。1. 首先看系统的响应:平稳随机过程x通过LSI系统h的输出。输出的自相关是输入自相关、系统和系统反演的卷积。输出功率谱是输入功率谱和系统函数绝对值平方的乘积。signal: x[n]system: h[n]output: y[n]y[n] = x[n] * h[n]R{n,r,y} = E{y[n] y[n-r]'} = E{ (x[ 阅读全文
posted @ 2009-09-29 15:40 quanben 阅读(166) 评论(0) 推荐(0)
摘要:解码应用过程:1. 用以下过程应用H264解码器main(){ AVFrame pic; dsputil_static_init(); // 跟踪了很深才发现的,如果不调用,内部算法数据都没初始化 AVCodecContext *pAVCtx = avcodec_alloc_context(); // 创建解码context,返回创建后指针 avcodec_open(pAVCtx, &h264_decoder); bool framegot; while (...) { while (!framegot) { 从pBuf开始解析收集将近1帧数据,长度bytesCollected ... 阅读全文
posted @ 2009-08-01 19:19 quanben 阅读(567) 评论(0) 推荐(0)
摘要:解析以OpenMAX非Tunneled为例,从应用线程开始。一、应用线程基本流程1. OMX_Init()2. 获取句柄,组件转到Loaded状态 OMX_GetHandle(out handle, in componentName, in appData, in callbacks); 其中callbacks结构包括三个回调函数指针(作用后文介绍): 1) EventHandler 2) EmptyBufferDone 3) FillBufferDone3. 参数交互 如: OMX_GetParameter(in handle, in type, out param); OMX_SetPa. 阅读全文
posted @ 2008-10-07 13:49 quanben 阅读(422) 评论(0) 推荐(0)
摘要:The following parameters are only for recommendation.These parameters always slip off my mind.Video chatting(QCIF)MPEG-4 Simple Profile, Level 0 (1object allowed at maximum). (up to 4-object allowed in Level1 (up to QCIF), 2 and 3(up to CIF))H.263 Baseline Profile + I,J,K,T, Level 10.Stream media / 阅读全文
posted @ 2008-10-07 10:44 quanben 阅读(163) 评论(0) 推荐(0)
摘要:H.264环路内滤波顾名思义在编码侧开启后解码部分必须跟随开启,因此是该视频编码方案的不可分割的组成部分。以下整理了Baseline情形下环路滤波的四种情形:All cases that may exist for BaselineBs = 4:either is intra, MB edgeBs = 3:either is intra, block edgeBs = 2: both are inter, either is codedBs = 1: both are inter neither is coded, different ref pictures, either MV comp. 阅读全文
posted @ 2008-09-08 11:21 quanben 阅读(403) 评论(0) 推荐(0)
摘要:The need of error code generation is growing in the field of communication. Both the imitation of real situation and the feasibility of the implementation are in the consideration. The simple Markov model is just one step from the plain one (uniform distribution noise).The model can be described as: 阅读全文
posted @ 2008-08-03 13:52 quanben 阅读(176) 评论(0) 推荐(0)
摘要:The code is to smooth out the JPEG artifacts on some digitized maps in order to facilitate the PNG compression. I finally decided to use some flood-style algorithm the result of which is somewhat satifactory (As applied on the 640x480 sample image, the sizeof the output PNG file is reduced from 613K 阅读全文
posted @ 2008-04-16 23:55 quanben 阅读(197) 评论(0) 推荐(0)
摘要:1. Interpolation (likely bug), detected and corrected.2. Deblocking (bug/incompatiblity), detected and verified. Solutions recommended: replacement by X264, JM, P264, ... 阅读全文
posted @ 2008-04-04 16:58 quanben 阅读(102) 评论(0) 推荐(0)
摘要:The core of TMN5 is the virtual buffer, the size of which is specified by r = alpha * bits_per_frame, where alpha is the multiple, typically 2. The larger value of alpha provides larger dynamical range, but less adjustment sensitivity. The current fullness of the buffer 'd' serves as the ref 阅读全文
posted @ 2008-02-03 23:55 quanben 阅读(232) 评论(0) 推荐(0)
摘要:Item PDF DJVU Description of Layout Driven by (a subset of) PostScript ... 阅读全文
posted @ 2008-01-15 21:27 quanben 阅读(191) 评论(0) 推荐(0)
摘要:本章讨论的代码主要位于common/predict.c中。x264_macroblock_cache_load函数在每个宏块解码之前初始化某些状态,在x264_slice_write函数的宏块处理循环中被调用。i_mb_xy: 当前宏块的索引i_mb_4x4: 当前宏块中第一个4x4块的索引i_mb_8x8: 当前宏块中第一个8x8块的索引i_top_y: 上方宏块的y索引i_top_xy: 上方宏块的索引i_top_4x4: 当前宏块中第一个4x4块上方的4x4块的索引i_top_8x8: 当前宏块中第一个8x8块上方的8x8块的索引这里首先初始化和当前宏块毗邻的已解码块。这里用到x264_ 阅读全文
posted @ 2007-08-27 11:04 quanben 阅读(303) 评论(0) 推荐(0)
摘要:这里主要有一下几个过程:1. 初始化h->stat.frame,即全部清零。2. 写条带头:x264_slice_header_write,即把刚才x264_slice_header_init设置的一些参数写入。3. 如果是CABAC编码,则初始化CABAC。有关CABAC在后续相关章节讨论。4. 遍历一帧中的所有宏块,这是编码的主要部分:for( mb_xy = h->sh.i_first_mb, i_skip = 0; mb_xy < h->sh.i_last_mb; )其中sh.i_first_mb和sh.i_last_mb在x264_slice_header_i 阅读全文
posted @ 2007-07-24 15:39 quanben 阅读(482) 评论(0) 推荐(0)
摘要:H.264标准写得比较繁复,所以考虑在浏览完Whitepaper之后就开始研读X264代码。X264代码风格还是比较清晰简洁的。根据对标准的理解,Picture Order Count在Slice解码的一开始就被提及:I0 B1 B2 P3 B4 B5 P6I0 P3 B1 B2 P6 B4 B5于是I0的POC是0,P3的POC是3,B1是1……为了支持H264复杂的帧存机制,X264以专门的一个模块frame.c进行处理。common/frame.c中包括一组帧缓冲操作函数。包括对帧进行FILO和FIFO存取,空闲帧队列的相应操作等。以下逐个函数分析encoder.c中编码一帧的函数x26 阅读全文
posted @ 2007-07-24 14:00 quanben 阅读(316) 评论(0) 推荐(0)
摘要:对于PDF提出的纠正漂移的三种方法,其第一种是在残差支路上添加补偿。可以证明,高精度环路方程变为:dH,n(fn) = qH(fn - rn-1(dH,n-1(fn-1)) + D') + rn-1(dH,n-1(fn-1)),而低精度环路方程为:dL,n(fn) = qL(fn - rn-1(dH,n-1(fn-1)) + D') + rn-1(dL,n-1(fn-1)),于是可以通过D'调整量化结果,但这样应该会影响高精度解码的效果。 另两种方法则是对补偿量p本身进行调整。 K(rn(qH(fn - bn-1) - qL(fn - bn-1) + pn-1)) = 阅读全文
posted @ 2007-05-28 23:19 quanben 阅读(202) 评论(0) 推荐(0)