Tutorial 08: Software Scaling
来源:互联网 发布:windows 连接小米音响 编辑:程序博客网 时间:2024/06/05 01:04
Tutorial 08: Software Scaling
Code: tutorial08.c
libswscale
ffmpeg has recently added a new interface, libswscale to handle image scaling. Whereas before in our player we would use img_convert to go from RGB to YUV12, we now use the new interface. This new interface is more modular, faster, and I believe has MMX optimization stuff. In other words, it's the preferred way to do scaling.
The basic function we're going to use to scale is sws_scale. But first, we're going to have to set up what's called an SwsContext. This allows us to compile the conversion we want, and then pass that in later to sws_scale. It's kind of like a prepared statement in SQL or a compiled regexp in Python. To prepare this context, we use the sws_getContext function, which is going to want our source width and height, our desired width and height, the source format and desired format, along with some other options and flags. Then we use sws_scale the same way as img_convert except we pass it our SwsContext:
and we have our new scaler in place. Hopefully this gives you a good idea of what libswscale can do.
That's it! We're done! Go ahead and compile your player:
gcc -o tutorial08 tutorial08.c -lavutil -lavformat -lavcodec -lz -lm `sdl-config --cflags --libs`
and enjoy your movie player made in less than 1000 lines of C!
Of course, there's a lot of things we glanced over that we could add.
- Tutorial 08: Software Scaling
- Tutorial 8:Scaling Transformation
- KDD 2011的关于Scaling Up Machine Learning的Tutorial
- Cracking .Net Assembly software tutorial by KwazyWebbit
- CPU Scaling
- 3.scaling
- Geometric Scaling
- Image Scaling
- Image Scaling
- Image Scaling
- multidimensional scaling
- Scaling Lucene
- Feature scaling
- Feature scaling
- Image scaling
- software
- software
- software
- JAVA基本类型互相转换
- 为什么你从现在就应该好好学英语
- [转!]移植java虚拟机到mini2440
- 从现在开始,记录点点滴滴
- Python 模板使用
- Tutorial 08: Software Scaling
- 测试一下数据库记录客户端上一个跳转的连接地址
- 学习笔记之软件架构
- (转)EL表达式Map取值的隐含问题
- oracle联机日志
- SAP中寻找增强的实现方法
- [qualcomm android] sim card status processing
- ORA-01157: cannot identify/lock data file 27 - see DBWR trace file
- java中多种方式读文件,追加文件内容,对文件的各种操作