一个有趣的avs编码器(注意,是avs,而不是avs2噢)
本章附件是一个清华大学写的关于avs编解码器:
https://download.csdn.net/download/weixin_43360707/87793302
该编码器遵循了stuffing bit:
打开文件夹后,如下:
可以看出这个是个跨平台的工程,提供了windows vs2015的工程文件sln,以及linux的makefile,因为本次我们考虑的是avs encoder,所以进入到lencod:
看到里面有个makefile,这个就是我们的makefile文件。
我们执行
make
结果出现下面错误:
我们进入到文件fast_me.c中,删除PartCalMad前面的inline
重新编译,通过,在bin目录下看到如下:
lencod.exe就是我们要的编码器。
打开encoder.cfg文件,修改:
InputFile = "/workspace/encoder/libx264_640x360_baseline_5_frames-420.yuv" # Input sequence, YUV 4:2:0/4:2:2
SourceWidth = 640 # Image width in Pels
SourceHeight = 360 # Image height in Pels
TraceFile = "trace_enc.txt"
ReconFile = "test_rec.yuv"
OutputFile = "test-cai.avs"
然后执行:
lencod.exe -f encoder.cfg就可以正常编码了:
用mediainfo查看编码后的视频:
对于avs 1的尺寸,有下列严格要求:
/*
*************************************************************************
* Function:Checks the validity of input parameters in the specified level
* Input:
* Output:
* Return:
* Attention:
* Author: LiShao, Tsinghua, 20070327
*************************************************************************
*/
static void LevelCheck()
{float framerate[8]={24000/1001,24,25,30000/1001,30,50,60000/1001,60};if(input->frame_rate_code<1||input->frame_rate_code>8){printf("\n Undefined frame_rate in all levels. \n");exit(0);}switch (input->level_id){case 0x10:case 0x11: //rm52k{if(input->img_width>352){printf("\n Image Width exceeds level 2.0 restriction.\n");exit(-1);}else if(input->img_height>288){printf("\n Image height exceeds level 2.0 restriction.\n");exit(-1);}else{if(input->frame_rate_code>5){printf("\n Current frame_rate is not support in Level_2.0 .\n");exit(-1);}else {if((long)(input->img_width)*(long)(input->img_height)*(framerate[input->frame_rate_code-1])>2534400){printf("\n Luma Sampling Rate invalid for level 2.0.\n");exit(-1);}}}if((long)(input->img_width)*(long)(input->img_height)/256>396){printf("\n The number of macroblock per frame exceeds 396 in level 2.0.\n");exit(-1);}if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>11880){printf(" \n The number of macroblock per second exceeds 11880 in level 2.0.\n");exit(-1);}if(input->chroma_format!=1){printf("\n In level 2.0 only format 4:2:0 is supported.\n");exit(-1);}//rm52kif(input->level_id==0x10 && input->bbv_buffer_size>122880){printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}if(input->level_id==0x11 && input->bbv_buffer_size>311296){printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}//rm52kbreak; }case 0x20:{if(input->img_width>720){printf("\n Image Width exceeds level 4.0's restriction.\n");exit(-1);}else if(input->img_height>576){printf("\n Imgage Height exceeds level 4.0's restriction.\n");exit(-1);}else{if(input->frame_rate_code>5){printf("\n Current frame_rate is not support in Level_4.0 .\n");exit(-1);}else{if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>10368000){printf("\n Luma Sampling Rate invalid for level 4.0.\n");exit(-1);} }}if((long)(input->img_width)*(long)(input->img_height)/256>4050){printf(" \n The number of macroblock per frame exceeds 1,620 for Level_4.0.\n");exit(-1);}if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>40500){printf(" \n The number of macroblock per second exceeds 40500 in Level_4.0.\n");exit(-1);}if(input->chroma_format!=1){printf("\n In level 4.0 only format 4:2:0 is supported.\n");exit(-1);}if(input->bbv_buffer_size>1228800) //rm52k{printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}break;}case 0x22:{if(input->img_width>720){printf("\n Imgage Width exceeds level 4.2's restriction.\n");exit(-1);}else if(input->img_height>576){printf("\n Image Height exceeds level 4.2's restriction.\n");exit(-1);}else{if(input->frame_rate_code>5){printf("\n Current frame_rate is not support in Level_4.2 .\n");exit(-1);}else{if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>10368000){printf("\n Luma Sampling Rate invalid for level 4.2.\n");exit(-1);}}}if((long)(input->img_width)*(long)(input->img_height)/256>1620){printf(" \n The number of macroblock per frame exceeds 1,620 for Level_4.2.\n");exit(-1);}if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>40500){printf(" \n The number of macroblock per second exceeds 40500 in Level_4.2.\n");exit(-1);}if(input->chroma_format!=1&&input->chroma_format!=2){printf("\n In level 4.2 only format 4:2:0 and 4:2:2 are supported.\n");exit(-1);}if(input->bbv_buffer_size>1851392) //rm52k{printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}break;}case 0x40:case 0x41: //rm52k{if(input->img_width>1920){printf("\n Imgage Width exceeds level 6.0's restriction.\n");exit(-1);}else if(input->img_height>1152){printf("\n Image Height exceeds level 6.0's restriction.\n");exit(-1);}else{if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>62668800){printf("\n Luma Sampling Rate invalid for level 6.0.\n");exit(-1);}} if((long)(input->img_width)*(long)(input->img_height)/256>8160){printf(" \n The number of macroblock per frame exceeds 8160 for Level_6.0.\n");exit(-1);}if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>244800){printf(" \n The number of macroblock per second exceeds 244800 in Level_6.0.\n");exit(-1);}if(input->chroma_format!=1){printf("\n In level 6.0 only format 4:2:0 is supported.\n");exit(-1);}//rm52kif(input->level_id==0x40 && input->bbv_buffer_size>2457600) {printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}if(input->level_id==0x41 && input->bbv_buffer_size>6144000) {printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}//rm52kbreak; } case 0x42:{if(input->img_width>1920){printf("\n Imgage Width exceeds level 6.2's restriction.\n");exit(-1);}else if(input->img_height>1152){printf("\n Imgage Height exceeds level 6.2's restriction.\n");exit(-1);}else{if((long)(input->img_width)*(long)(input->img_height)*(long)(framerate[input->frame_rate_code-1])>62668800){printf("\n Luma Sampling Rate invalid for level 6.2.\n");exit(-1);}}if((long)(input->img_width)*(long)(input->img_height)/256>8160){printf(" \n The number of macroblock per frame exceeds 8160 for Level_6.2.\n");exit(-1);}if((long)(input->img_width)*(long)(input->img_height)*framerate[input->frame_rate_code-1]/256>244800){printf(" \n The number of macroblock per second exceeds 244800 in Level_6.2.\n");exit(-1);}if(input->chroma_format!=1&&input->chroma_format!=2){printf("\n In level 6.2 only format 4:2:0 and 4:2:2 are supported.\n");exit(-1);}if(input->bbv_buffer_size>3686400) //rm52k{printf("\n Invalid Bbv_Buffer_Size input.\n");exit(-1);}break;}default: {printf("\n No such level_ID. \n");exit(-1);}}}
一个有趣的avs编码器(注意,是avs,而不是avs2噢)相关推荐
- 给小孩发布一个有趣的网站 在线动物园
给小孩发布一个有趣的网站 在线动物园,可以实时看到动物园里的动物实时摄像头. 非常有意思,大热天也不用到动物园里看了. http://zoo.baidu.com/video.html
- 一个有趣的实验:用0.1f 替换 0,性能提升 7 倍!
点击关注上方"视学算法",设为"置顶或星标",第一时间送达技术干货. 本文来源:http://cenalulu.github.io/linux/about-de ...
- 一个有趣的小例子,带你入门协程模块-asyncio
上篇文章写了关于yield from的用法,简单的了解异步模式,[上次的内容链接]这次让我们通过一个有趣例子带大家了解asyncio基本使用. 目标效果图 在控制台中显示一个由ASCII字符" ...
- 这是一个有趣的问题,Java 8 Lambda 表达式被编译成了什么?
在了解了Java 8 Lambda的一些基本概念和应用后, 我们会有这样的一个问题: Lambda表达式被编译成了什么? 这是一个有趣的问题,涉及到JDK的具体的实现.本文将介绍OpenJDK对Lam ...
- union一个有趣的应用
今天在读<Linux高性能服务器编程>时看到一个有趣的东西.书中用了一个特别的方法去求字节序.我们知道字节序分为大端和小端,大端就是数据的高位字节存储在内存的低地址处,小段则反之.那么我们 ...
- 分享一个有趣的学习方法,欢迎一起探讨如何提高学习兴趣作者:1-2-3 来源:博客园 发布时间:2009-03-09 16:20 阅读:2820 次 原文链接 [收藏]
分享一个有趣的学习方法,欢迎一起探讨如何提高学习兴趣 作者:1-2-3 来源:博客园 发布时间:2009-03-09 16:20 阅读:2820 次 原文链接 [收藏] 有些人似乎天生 ...
- 编写一个弹出式菜单的shell程序_分享一个有趣的shell脚本--实现抓阄程序
概述 今天主要分享一个有趣的shell脚本,用来实现抓阄,平时就不用剪刀石头布了. 需求 使用shell编写一个抓阄的程序: 1.执行脚本后,输入英文名字全拼,产生随机数01-99之间的数字,数字越大 ...
- firebug的一个有趣现象
firebug的一个有趣现象 var obj = {length:0,splice:function(){}}console.log(obj) 猜猜上面会打印出啥? 没错,打印出来的看起来是一个空数组 ...
- 一个有趣的问题,讨论讨论
昨天和一位同事讨论项目过程的一个问题,他提出一个有趣的案例: 假设制作一批茶壶,预定时间是10号,综合考虑10号之前肯定完成,于是定了10号的船,结果制作厂商5号就完成了,表面看起来提前完成是一个好事 ...
最新文章
- BeagleBone Black项目实训手册(大学霸内部资料)
- [zhuan]二叉树遍历算法实现(C#2.0)
- vue2.0 创建项目
- 必备快速定位排查问题命令
- 《犯罪心理学》读书笔记(part3)--影响犯罪心理形成发展的外部因素
- vue 混入对象_特性和混入不是面向对象的
- (第二章)mysql创建数据库
- 全局唯一递增的id_细聊分布式ID生成方法
- 面试题,微信朋友圈的“赞”和“评论”为啥是隐藏操作的?
- 蓝色的网站商城后台通用管理模板——后台
- 在vue2项目中使用腾讯云IM及常见问题
- 使用Typora编辑器编写md文档插入图片方法
- Ubuntu18.04 因断电开机报错:utmp处卡死
- php立方体相册源码,纯CSS实现3D的代码(正方体、动态立体图片册、平面的星空)...
- windows10罪过_七大罪过与如何避免
- 光标快速移动到文档尾部_把光标移动到文件尾部的快捷键是什么呢?
- Excel学习笔记-图表(双向条形图、甘特图、饼图、往PPT中插入图表)
- 【软件项目管理】任务(活动)之间的排序依据主要有:强制性依赖关系、软逻辑关系、外部依赖关系
- xml文件配置多数据源
- python通过onvif协议搜索局域网所有摄像头ip,并获取摄像头rtsp,mac地址等相关服务