diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-25 05:03:51 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-25 05:03:51 +0200 |
commit | 54bb7a2582ce084895dcd0c6511dda4baf9a6c0e (patch) | |
tree | fe7d16a2a5f8131f2cef595933dd65bbfc25bf4b | |
parent | 66f6f9f0768de5b003fc1b0fa9b1ea428466308a (diff) | |
parent | d1e6b2360c90db4293f3ff40a92c8e4dfa331679 (diff) |
Merge svn changes up to r28728
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | DOCS/man/en/mplayer.1 | 24 | ||||
-rw-r--r-- | DOCS/man/zh_CN/mplayer.1 | 242 | ||||
-rw-r--r-- | help/help_mp-de.h | 19 | ||||
-rw-r--r-- | libswscale/Makefile | 2 | ||||
-rw-r--r-- | libswscale/yuv2rgb.c | 991 | ||||
-rw-r--r-- | libswscale/yuv2rgb2.c | 683 | ||||
-rw-r--r-- | libswscale/yuv2rgb_altivec.c | 16 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 52 | ||||
-rw-r--r-- | libvo/w32_common.c | 11 | ||||
-rwxr-xr-x | version.sh | 11 |
11 files changed, 712 insertions, 1342 deletions
@@ -956,6 +956,9 @@ MPlayerPL - Polish MPlayer Translation Team (http://mplayerpl.emdej.com) * Marek Jarycki (Emdej) <emdej@emdej.com> * Leszek Kaplita (Flex) <flex@tenbit.pl> +Zhu Tian (JRaSH) <jrash06@gmail.com> + * Simplified Chinese documentation translation + Zubimendi, Andoni <andoni@lpsat.net>. * Spanish documentation translation diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 81ebd0cbec..dd16b4d047 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -3426,6 +3426,30 @@ Select the driver to use as source to overlay on top of X11. .B vdpau (with \-vc ffmpeg12vdpau, ffwmv3vdpau, ffvc1vdpau or ffh264vdpau) Video output that uses VDPAU to decode video via hardware. Also supports displaying of software-decoded video. +.PD 0 +.RSs +.IPs sharpen=<\-1\-1> +For positive values, apply a sharpening algorithm to the video, +for negative values a blurring algorithm (default: 0). +.IPs denoise=<0\-1> +Apply a noise reduction algorithm to the video (default: 0, no noise reduction). +.IPs deint=<0\-3> +Chooses the deinterlacer (default: 0). +.RSss +.IPs 0 +No deinterlacing. +.IPs 1 +Bob deinterlacing (current fallback for advanced deinterlacers). +.IPs 2 +Motion adaptive temporal deinterlacing (not yet working). +.IPs 3 +Motion adaptive temporal deinterlacing with edge-guided spatial interpolation +(not yet working). +.RE +.IPs pullup +Try to apply inverse telecine, needs deinterlacing. +.RE +.PD 1 . .TP .B xvmc (X11 with \-vc ffmpeg12mc only) diff --git a/DOCS/man/zh_CN/mplayer.1 b/DOCS/man/zh_CN/mplayer.1 index a18f1f1ba0..1dfb72373e 100644 --- a/DOCS/man/zh_CN/mplayer.1 +++ b/DOCS/man/zh_CN/mplayer.1 @@ -1,4 +1,4 @@ -.\" sync with en/mplayer.1 r27348 +.\" sync with en/mplayer.1 r28576 .\" Encoding: UTF-8 .\" Reminder of hard terms which need better/final solution later: .\" /capture; playtree in parent list; colorkey; retrace; desync; downmix; @@ -43,7 +43,7 @@ .\" 名称 .\" -------------------------------------------------------------------------- . -.TH MPlayer 1 "2008-01-01" "MPlayer 项目" "电影播放器" +.TH MPlayer 1 "2009-01-05" "MPlayer 项目" "电影播放器" . .SH 名称 mplayer \- 影视播放器 @@ -117,7 +117,7 @@ cue://文件[:曲目] . .br .B mplayer -[file|mms[t]|http|http_proxy|rt[s]p|ftp|udp|unsv|smb]:// +[file|mms[t]|http|http_proxy|rt[s]p|ftp|udp|unsv|icyx|noicyx|smb]:// [用户名:密码@]URL[:端口] [选项] . .br @@ -582,6 +582,7 @@ alang=en profile-desc="用于 dvdnav:// 媒体流的配置集" profile=protocol.dvd mouse-movements=yes +nocache=yes [extension.flv] profile-desc="用于 .flv 文件的配置集" @@ -712,8 +713,8 @@ GUI 的配置文件 对慢机器或者不能正确处理回车符(即 \\r)的旧机器特别有用。 . .TP -.B \-priority <优先> (仅适用于 Windows) -根据 Windows 下可用的预定义优先级设置 MPlayer 的进程优先级。 +.B \-priority <优先>(仅适用于 Windows 和 OS/2) +根据 Windows 和 OS/2 下可用的预定义优先级设置 MPlayer 的进程优先级。 可能的 <优先> 值为: .RSs idle|belownormal|normal|abovenormal|high|realtime @@ -864,6 +865,7 @@ MPlayer 执行此命令时不加以检查,所以你有责任确保该命令不 .sp 1 该选项可能被“误用”以禁用不提供对于适当的 X API 接口的支持的屏幕保护程序。 如果你觉得这太复杂了,请要求屏幕保护程序的作者提供对于适当的 X API 的支持。 +(另参见 \-stop\-xscreensaver) .sp 1 .I 用于 xscreensaver 的示例: mplayer \-heartbeat\-cmd "xscreensaver\-command \-deactivate" file @@ -982,8 +984,9 @@ n 大小的 FIFO 能容纳 (n\-1) 缓冲事件。 . .TP .B \-mouse\-movements -允许 MPlayer 接受指针事件来自视频输出驱动(目前仅支持 X11 衍生型)。 +允许 MPlayer 接收来自视频输出驱动的指针事件。 必须选择 DVD 菜单中的按钮。 +支持基于 X11 的视频输出(x11、xv、xvmc等)以及 gl、gl2、direct3d 和 macosx 的视频输出 . .TP .B \-noar @@ -1096,15 +1099,24 @@ MPlayer 从标准输入读取以新行 (\\n) 分隔开的命令行, 此选项仅当 AC-3 流包含所需范围的压缩信息时显示效果。 . .TP -.B \-aid <标识> (也请参见 \-alang) +.B \-aid <代码> (也请参见 \-alang) 选择音频频道 (MPEG: 0\-31, AVI/\:OGM: 1\-99, ASF/\:RM: 0\-127, VOB(AC-3): 128\-159, VOB(LPCM): 160\-191, MPEG-TS 17\-8190)。 -MPlayer 在 verbose (\-v) 模式下会打印可用的音频标识。 +MPlayer 在 verbose (\-v) 模式下会打印可用的音频代码。 当播放 MPEG-TS 流时, MPlayer/\:MEncoder 用第一个程序 播放已选择的(如果有的话)音频流。 . .TP -.B \-alang <语言代号[,语言代号,...]> (也请参见 \-aid) +.B \-ausid <代码>(也请参见 \-alang) +选择子音频流的频道。 +当前有效的取值范围为 0x55..0x75,并且当由原生流分解器(而不是 libavformat)时处理时, +只适用于MPEG-TS。 +由于媒体类型信息在媒体流中的嵌入方式有异或其在流中缺失,媒体类型可能无法正确识别,但当 +多个子流存在时,音频流会正确分解出来。 +当使用 \-identify 运行时,MPlayer 打印出可用的子流的代码。 +. +.TP +.B \-alang <语言代码[,语言代码,...]> (也请参见 \-aid) 指定使用音频语言的优先级列表。 不同的容器格式使用不同的语言代号。DVDs 使用 ISO 639\-1 的 两字符语言代号, Matroska、MPEG-TS 和 NUT 使用 ISO 639\-2 的 @@ -1938,8 +1950,7 @@ MPlayer将同时打印“-tv channels=”选项中的值,包括已有的以及 你可能也想使用 \-embeddedfonts。 .br .I 注意: -当字体配置是预先编译进去的时,除非明确使用 \-nofontconfig 关闭该选项, -否则 \-ass 将打开 \-fontconfig。 +不像通常的 OSD,libass 默认使用 fontconfig。使用 \-nofontconfig 以禁用此行为。 . .TP .B \-ass\-border\-color <参数值> @@ -2421,6 +2432,10 @@ CC 字幕到目前为止还没有在其它地区码的 DVD 中发现。 .B \-vobsubid <0\-31> 指定 VOBsub 字幕标识。 . +.TP +.B \-vobsubid <0\-31> +指定 VOBsub 的字幕代码。 +. . . .SH "音频输出选项(仅适用于MPLAYER)" @@ -2565,6 +2580,9 @@ OSS 音频输出驱动 如果你想自动建立某些连接时有用。 .IPs (no)estimate 估计音频延迟, 假定让视频回放更流畅 (默认是: 启用)。 +.IPs (no)autostart(默认值:禁用) +当有需要时自动启动 jackd。 +注意该选项似乎不可靠,并且会往标准输出发送服务端消息。 .RE .PD 1 . @@ -2648,7 +2666,7 @@ DVB 卡音频输出驱动输出到 MPEG-PES 文件如果没安装 DVB 卡。 .RSs .IPs card=<1\-4> 指定 DVB 卡如果有多于一个卡。 -如果不指定,mplayer 将搜索第一个可用的卡。 +如果不指定,MPlayer 将搜索第一个可用的卡。 If not specified mplayer will search the first usable card. .IPs file=<文件名> 输出文件名 @@ -2884,9 +2902,9 @@ x 和 y 代表从屏幕左上角到显示图像左上角的距离(以像素为 如果使用 \-wid 选项指定了外部窗口, 那么 x 和 y 坐标是相对于窗口而不是屏幕的左上角。 .br -.I 注意: -此选项仅被 x11, xmga, xv, xvmc, xvidix, -gl, gl2, directx 和 tdfxfb 视频输出驱动支持。 +.I 注意: +此选项仅被 x11、xmga、xv、xvmc、xvidix、 +gl、gl2、directx、fbdev 和 tdfxfb 视频输出驱动支持。 .sp 1 .I 示例: .PD 0 @@ -3007,15 +3025,16 @@ ggi 和 gl2 的都支持此功能。 . .TP .B \-screenh <像素> -指定垂直分辨率, 如果视频输出驱动不知道屏幕分辨率, 如 fbdev, x11 和 TVout。 +指定屏幕高度,如果视频输出驱动,如 fbdev, x11 和 TVout,不知道屏幕分辨率。 . .TP .B \-screenw <pixels> -指定水平分辨率, 如果视频输出驱动不知道屏幕分辨率, 如 fbdev, x11 和 TVout。 +指定屏幕宽度,如果视频输出驱动,如 fbdev, x11 和 TVout,不知道屏幕分辨率。 . .TP .B \-stop\-xscreensaver (仅用于 X11) 启动时关闭 xscreensaver, 退出时再打开它。 +如果你的屏保程序不支持 XSS 或 XResetScreenSaver 的 API,则请使用 \-heartbeat\-cmd 选项。 . .TP .B "\-vm \ \ \ " @@ -3041,7 +3060,7 @@ ggi 和 gl2 的都支持此功能。 息),\-1 表示在目前窗口所在的显示屏上全屏幕。 通过 \-geometry 选项设置的初始位置是相对于指定屏幕的。 通常只能与 "\-fstype \-fullscreen" 或 "\-fstype none" 一起工作。 -该选项不适用于仅仅设置启动屏幕(也不适用于设置全屏屏幕),\-geometry 是目前可用 +该选项不适用于仅仅设置启动屏幕(因为其总是在指定的屏幕上以全屏方式显示),\-geometry 是目前可用 于此目前的最好选项。 This option is not suitable to only set the startup screen (and not also the fullscreen screen), \-geometry is the best that is available for that purpose @@ -3214,9 +3233,11 @@ Supported by the gl, gl2, x11, and xv video output drivers. 考虑废弃。 . .TP -.B sdl (仅用于 SDL) +.B sdl(仅用于 SDL,漏洞多且过时) 高级平台独立的 SDL(简单 Directmedia 层) 库视频输出驱动。 既然 SDL 使用自己的 X11 层, MPlayer X11 选项对 SDL 没有影响。 +注意该选项有数个非重要漏洞(总是忽略 \-vm/\-novm,\-fs 的行为如同 \-novm, +当从全屏模式切换回来时窗口在左上角,不支持全景模式……) .PD 0 .RSs .IPs driver=<驱动> @@ -3236,8 +3257,9 @@ VIDIX (VIDeo Interface for *niX) 是不同显卡的视频加速特性的接口 .RSs .IPs <子设备> 明确表示选择使用哪个 VIDIX 子设备驱动。 -可用的子设备有 cyberblade, mach64, mga_crtc2, mga, nvidia, pm2, pm3, radeon, -rage128, sis 和 unichrome。 +可用的子设备有 cyberblade, ivtv, mach64, +mga_crtc2, mga, nvidia, pm2, pm3, radeon, rage128, s3, sh_veu, +sis_vid 和 unichrome。 .RE .PD 1 . @@ -3272,6 +3294,10 @@ VIDIX 的 Windows 前台 .PD 1 . .TP +.B direct3d(仅适用于 Windows)(公测代码!) +使用 Direct3D 接口的视频输出驱动(对于 Vista 系统很有用)。 +. +.TP .B directx (仅用于 Windows) 使用 DirectX 接口的视频输出驱动。 .PD 0 @@ -3301,7 +3327,14 @@ Mac OS X CoreVideo 视频输出驱动 .PD 0 .RSs .IPs device_id=<数值> -选择全屏显示设备。 +选择用于全屏模式的显示设备,或将其设为 \-1 以总是使用视频窗口所在的屏幕 +(默认值:\-1 \- 自动选择)。 +.IPs shared_buffer +将输出写入一块共享内存模式的缓冲区,而不是将其显示出来,并且尝试打开一个 +已存在的 NSConnection 连接以与图形界面通信。 +.IPs buffer_name=<名字> +shm_open 创建的共享缓冲区的名字,也是 MPlayer 尝试打开的 NSConnection 连接 +的名字(默认值:“mplayerosx”)。 .RE .PD 1 . @@ -3376,7 +3409,7 @@ OpenGL 视频输出驱动, 简版。 但也利用较新的扩展, 允许支持更多的色彩空间和直接渲染。 要获取最佳的速度,请尝试类似于 .br -\-vo gl:yuv=2:force\-pbo:ati\-hack \-dr \-noslices +\-vo gl:yuv=2:rectangle=2:force\-pbo:ati\-hack \-dr \-noslices .br 的选项。 此代码执行极少的检测, 所以如果某个特性不工作, @@ -3455,6 +3488,9 @@ GL_ARB_fragment_shader!)。至少需要三个纹理单位。提供饱和度 对红, 绿和蓝色, Gamma 也能被独立设置。 速度比其他方法更多地依赖于 GPU 内存带宽。 .RE +.IPs ycbcr +使用 GL_MESA_ycbcr_texture 扩展组件完成 YUV 至 RGB 的转换。 +在大多数情况下,这可能比使用软件方式转换至 RGB 要慢。 .IPs lscale=<n> 选择缩放功能供调节发光性。 仅对 yuv 模式 2, 3, 4 和 6 有效。 @@ -3470,13 +3506,15 @@ GL_ARB_fragment_shader!)。至少需要三个纹理单位。提供饱和度 3:与 1 相同,但不使用参照纹理。 可能在一些显卡上运行较快。 .br -4:使用实验性的非锐化的蔽码,参数为支持 3x3 和 0.5 的强化。 +4:使用实验性的非锐化的蔽码,参数为支持 3x3 和 0.5 的默认强化值。(参见 filter-strength) .br -5:使用实验性的非锐化的蔽码,参数为支持 5x5 和 0.5 的强化。 +5:使用实验性的非锐化的蔽码,参数为支持 5x5 和 0.5 的默认强化值。(参见 filter-strength) .RE .IPs cscale=<n> 选择缩放功能供调节色度. 详情参见 lscale。 +.IPs filter-strength=<值> +设置支持该强度值的 lscale/cscale 滤镜的效果强度。 .IPs customprog=<文件名> 从 <文件名> 装载定制的片断程序。 示例参见 TOOLS/edgedect.fp。 @@ -3669,6 +3707,10 @@ S3 Virge专用的视频输出驱动。 .PD 1 . .TP +.B wii(仅适用于 Linux) +任天堂 Wii/GameCube 专用的视频输出驱动。 +. +.TP .B 3dfx (仅用于 Linux) 3dfx 专用的视频输出驱动,此驱动在 X11 上直接使用硬件。 只支持 16 bpp。 @@ -3771,7 +3813,7 @@ iTVC16) MPEG 解码器芯片 (Hauppauge WinTV PVR-150/250/350/500) .RSs .IPs card=<1\-4> 如果有多于一个 DVB 输出卡, 指定设备号 (仅适用于 V3 API, 比如 1.x.y 驱动系列)。 -如果不指定,mplayer 将搜索第一个可用的卡。 +如果不指定,MPlayer 将搜索第一个可用的卡。 .IPs <文件名> 输出文件名 (默认是: ./grab.mpg) .RE @@ -3920,6 +3962,11 @@ PGMYUV 像 PGM, 但也包含 U 和 V 平面, 添加在图像的底部。 .IPs z=<0\-9> 指定压缩级别。 0 没压缩, 9 最强压缩。 +.IPs outdir=<目录名> +指定保存 PNG 文件的目录(默认值:./)。 +.IPs alpha(默认值:noalpha) +创建使用 alpha 通道的 PNG 文件。 +注意 MPlayer 通常不支持 alpha 通道,所以该选项只在极少数情况下才有用。 .RE .PD 1 . @@ -4190,8 +4237,20 @@ mplayer video.nut \-vf format=bgr15 \-vo tga 如果 <宽度> 指定了, 就使用了低分辨率解码, 只要视频的宽度宽过(is major than)或等于 <宽度>。 .RE -.IPs "o\ \ \ \ " -FIXME:没有说明文档 +.B o=<键>=<值>[,<键>=<值>[,...]] +传递 AVOption 选项至 libavcoder 解码器。 +注意,欢迎制造一个使 o= 不再需要,而将所有未知选项传递至 AVOption 系统的补丁。 +AVOption 的完整列表可在 FFmpeg 用户手册中找到。 +注意某些选项可能与 MEncoder 选项冲突。 +.sp 1 +.RS +.I 示例: +.RE +.RSs +.PD 0 +.IPs o=debug=pict +.PD 1 +.RE .IPs "sb=<数值> (仅用于 MPEG-2)" 跳过宏块底部的制定行数。 .IPs "st=<数值> (仅用于 MPEG-2)" @@ -6119,7 +6178,7 @@ MPEG-2解码器设置的扫描场标志。 扫描”的警告。 不设选项时,它只是做普通的逆转电视图像模式处理,并且应当与 mencoder \-fps 30000/1001 \-ofps 24000/1001一同使用。 -当这个滤镜用于mplayer时,它将导致播放时帧速率不匀衡,但在通常情况下比 +当这个滤镜用于 MPlayer 时,它将导致播放时帧速率不匀衡,但在通常情况下比 使用pp=lb或不进行解除隔行扫描操作要好。 多个选项可以使用/.分隔开指定。 .RSs @@ -6911,11 +6970,11 @@ h参数值。 .B \-<codec>opts <option1[=value1]:option2[=value2]:...> . .PP -这里<codec>可以是:lavc、xvidenc、lame、toolame、twolame、nuv、xvfw、faac、 +这里<codec>可以是:lavc、xvidenc、mp3lame、toolame、twolame、nuv、xvfw、faac、 x264enc、mpeg、lavf。 . . -.SS lame (\-lameopts) +.SS mp3lame (\-lameopts) . .TP .B "help\ \ \ " @@ -7145,6 +7204,22 @@ MPEG版本(默认值:4) .PD 1 . .TP +.B o=<key>=<value>[,<key>=<value>[,...]] +将 AVOption 选项传递至 libavcodec 编码器。 +注意,欢迎提供一个使 o= 选项不再需要,而将所有未知选项传递至 AVOption 系统的补丁。 +AVOption 的完整列表可以 FFmpeg 用户手册中找到。 +注意有些 AVOption 选项可能与 MEncoder 选项冲突。 +.sp 1 +.RS +.I 示例: +.RE +.RSs +.PD 0 +.IPs o=bt=100k +.PD 1 +.RE +. +.TP .B acodec=<value> 音频编解码器(默认值:mp2) .PD 0 @@ -7681,22 +7756,14 @@ lmin= <I/P帧量化参数>:lmax= <I/P帧量化参数>:vb_qfactor= <B帧量化参 .TP .B vqcomp=<0.0\-1.0> 量化参数压缩,vrc_eq选项依赖于该选项(默认值:0.5)。 -例如,假设使用了默认的码率控制方程式,如果vqcomp=1.0,那么码率控制过程中将分配给 -每个帧足够的比特数,以使它们在同一个量化参数下编码。 -如果vqcomp=0.0,那么码率控制中将分配给每个帧相同的比特数,也就是严格的CBR模式。 .I 注意: -以上都是极端性的设置,应当从不使用。 -在这两个极端值之间的某个值能使感观质量达到最优。 +在两个极端值之间的某个值能使感观质量达到最优。 . .TP .B vrc_eq=<equation> 主码率控制方程式 .RE .RSs -.IPs "1\ \ \ \ " -恒定比特率 -.IPs "tex\ \ " -恒定质量 .IPs 1+(tex/\:avgTex-1)*qComp 近似于以前码率控制代码所用的方程式 .IPs tex^qComp @@ -8473,6 +8540,10 @@ denoise3d或hqdn3d之类的视频滤镜来过滤噪声。 当前该选项只有当场景切换侦测功能禁用时才能工作(sc_threshold=1000000000)。 . .TP +.B "gmc\ \ \ \ " +启动全局动作补偿。 +. +.TP .B (no)lowdelay 设置用于 MPEG-1/2 的低延迟标志(禁用B帧)。 . @@ -8513,10 +8584,6 @@ FIXME:为这个选项写说明文档。 .B skip_threshold=<0\-1000000> FIXME:为这个选项写说明文档。 . -.TP -.B "o\ \ \ \ \ \ " -FIXME:没有说明文档 -. . .SS nuv(\-nuvopts) . @@ -9365,33 +9432,42 @@ p4x4只在subq >= 5,并且分辨率低时才推荐使用。 彻底性运动搜索或多六边形运动搜索的半径(默认值:16) . .TP -.B subq=<1\-7> +.B subq=<0\-9> 调整亚像素优化质量。 该参数控制的是运动估计决策过程中质量与速度的权衡。 subq=5能比subq=1多压缩掉10%。 .PD 0 .RSs -.IPs 1 +.IPs 0 对于所有候选宏块类型运行全像素精度的运动估计操作。 -然后选择最佳的类型。 -然后优化这种类型的运动值,使其达到快速四分之一像素模式的精度(运行最快)。 +然后选择 SAD 指标最佳的类型(比 subq=1 快,不推荐,除非 +你需要极其快速的编码)。 +.IPs 1 +执行值为 0 时的操作, +然后优化这种类型的运动值,使其达到快速四分之一像素模式的精度(运行快)。 .IPs 2 对于所有候选宏块类型运行半像素精度的运动估计操作。 -然后选择最佳的类型。 +然后选择 SATD 指标最佳的类型。 然后优化这种类型的运动值,使其达到快速四分之一像素模式的精度。 .IPs 3 与2相似,但采用较慢的四分之一像素优化模式。 .IPs 4 对于所有候选宏块类型运行快速四分之一像素精度的运动估计操作。 -然后选择最佳的类型。 +然后选择 SATD 指标最佳的类型。 然后完成对于此种类型的四分之像素模式的优化操作。 .IPs 5 在选择最佳类型之前,对于所有候选宏块类型运行最佳质量的四分之一像素精度的运动估计 -操作(默认值)。 +操作。 +同时也使用 SATD 指标优化双向宏块中使用的两个运动矢量,而不是重用向前和向后搜索中 +找到的矢量。 .IPs 6 -启用I帧和P帧中宏块类型的码率失真优化模式。 +启用I帧和P帧中宏块类型的码率失真优化模式。(默认值) .IPs 7 -启用运动矢量和帧内模式的码率失真优化模式。(最佳) +在所有帧中启用宏块类型的码率失真优化模式。 +.IPs 8 +启用运动矢量的码率失真优化模式,以及I帧和P帧中的内部预测模式。 +.IPs 9 +启用运动矢量的码率失真优化模式,以及所有帧中的内部预测模式。(最佳) .RE .PD 1 .RS @@ -9411,17 +9487,7 @@ subq=5能比subq=1多压缩掉10%。 要求frameref>1。 . .TP -.B (no)brdo -启用B帧中宏块类型的码率失真优化。 -要求subq>=6。 -. -.TP -.B (no)bime -优化双向宏块中所用的两个运动矢量,而不是重复使用向前和向后搜索中得到的矢量。 -没有B帧时这个选项没有任何作用。 -. -.TP -.B trellis=<0\-2> +.B trellis=<0\-2>(仅适用于 cabac) 码率失真最优的量化模式 .PD 0 .RSs @@ -9435,6 +9501,19 @@ subq=5能比subq=1多压缩掉10%。 .PD 1 . .TP +.B psy-rd=rd[,trell] +设置心理视觉优化模式的强度。 +.PD 0 +.RSs +.IPs rd=<0.0\-10.0> +心理优化模式的强度(要求 subq>=6)(默认值:1.0) +.IPs trell=<0.0\-10.0> +trellis(要求 trellis,实验性)(默认值:0.0) +.RE +.PD 1 +. +. +.TP .B deadzone_inter=<0\-32> 设置非格子因子量化模式中帧间亮度量化无效区的大小(默认值:21)。 较小的值有助于保留最好的细节和影片的粒度感(特别是对于高比特率/质量编码有用), @@ -9769,8 +9848,20 @@ PAL至NTSC的电视图像化处理 强制使用一个特定的 libav 格式库的分离器。 . .TP -.B "o\ \ \ \ \ \ " -FIXME:没有说明文档 +.B o=<键>=<值>[,<键>=<值>[,...]] +传递 AVOption 选项至 libavformat 流分解器。 +注意,欢迎制造一个使 o= 不再需要,而将所有未知选项传递至 AVOption 系统的补丁。 +AVOption 的完整列表可在 FFmpeg 用户手册中找到。 +注意某些选项可能与 MPlayer/MEncoder 选项冲突。 +.sp 1 +.RS +.I 示例: +.RE +.RSs +.PD 0 +.IPs o=ignidx +.PD 1 +.RE . .TP .B probesize=<value> @@ -9783,7 +9874,6 @@ FIXME:没有说明文档 该值是密钥的原始二进制数据转换后得到十六进制字符串。 . . -. .SS FFmpeg libavformat muxers(\-lavfopts)(另参见\-of lavf) . .TP @@ -9825,6 +9915,8 @@ MPEG-4格式 含有苹果 iPod 固件所需额外标志数据的 MPEG-4 格式 .IPs "dv\ \ \ " Sony 数字视频容器格式 +.IPs "matroska\ \ \ " +Matroska .RE .PD 1 .TP @@ -9834,8 +9926,20 @@ Sony 数字视频容器格式 有时需要提高这个值以防止“缓冲下溢”。 . .TP -.B "o\ \ \ \ \ \ " -FIXME:无说明文档 +.B o=<键>=<值>[,<键>=<值>[,...]] +传递 AVOption 选项至 libavformat 流合并器。 +注意,欢迎制造一个使 o= 不再需要,而将所有未知选项传递至 AVOption 系统的补丁。 +AVOption 的完整列表可在 FFmpeg 用户手册中找到。 +注意某些选项可能与 MEncoder 选项冲突。 +.sp 1 +.RS +.I 示例: +.RE +.RSs +.PD 0 +.IPs o=packetsize=100 +.PD 1 +.RE . .TP .B packetsize=<size> diff --git a/help/help_mp-de.h b/help/help_mp-de.h index 147ef34043..58a21f0fdb 100644 --- a/help/help_mp-de.h +++ b/help/help_mp-de.h @@ -4,7 +4,7 @@ // Alexander Strasser <eclipse7@gmx.net> // Sebastian Krämer <mail@kraymer.de> -// In sync with r27123 +// In sync with r28122 // TODO: cosmetic commit 27072 // FIXME: improve wording/meaning of periodsize|timer.. for ao_alsa.c strings @@ -54,13 +54,13 @@ static char help_text[]= "\n"; #endif -// libmpcodecs/ad_dvdpcm.c: +// libmpcodecs/ad_dvdpcm.c #define MSGTR_SamplesWanted "Beispiele für dieses Format werden gebraucht, um die Unterstützung zu verbessern. Bitte kontaktiere die Entwickler.\n" // ========================= MPlayer Ausgaben =========================== -// mplayer.c: +// mplayer.c #define MSGTR_Exiting "\nBeenden...\n" #define MSGTR_ExitingHow "\nBeenden... (%s)\n" #define MSGTR_Exit_quit "Ende" @@ -195,6 +195,7 @@ static char help_text[]= #define MSGTR_DvdnavNavSeekDone "DVDNAV-Ereignis: Nav Suche beendet.\n" #define MSGTR_MenuCall "Menü-Aufruf\n" +// --- edit decision lists #define MSGTR_EdlOutOfMem "Kann nicht genug Speicher für EDL-Daten reservieren.\n" #define MSGTR_EdlRecordsNo "%d EDL-Aktionen gelesen.\n" #define MSGTR_EdlQueueEmpty "Es gibt keine auszuführenden EDL-Aktionen.\n" @@ -264,7 +265,7 @@ static char help_text[]= #define MSGTR_SubVisibleStatus "Untertitel: %s" #define MSGTR_SubForcedOnlyStatus "Erzwungene Untertitel: %s" -// mencoder.c: +// mencoder.c #define MSGTR_UsingPass3ControlFile "Verwende Pass 3 Kontrolldatei: %s\n" #define MSGTR_MissingFilename "\nDateiname nicht angegeben.\n\n" #define MSGTR_CannotOpenFile_Device "Kann Datei/Gerät nicht öffnen.\n" @@ -484,7 +485,7 @@ static char help_text[]= " <8-320>: ABR-Encodierung mit der angegebenen durchschnittlichen\n"\ " Bitrate\n\n" -//codec-cfg.c: +//codec-cfg.c #define MSGTR_DuplicateFourcc "Doppelter FourCC." #define MSGTR_TooManyFourccs "Zu viele FourCCs/Formate..." #define MSGTR_ParseError "Fehler beim Parsen." @@ -543,7 +544,7 @@ static char help_text[]= #define MSGTR_PropertyListHeader "\n Name Typ Min Max\n\n" #define MSGTR_TotalProperties "\nInsgesamt: %d Eigenschaften\n" -// open.c, stream.c: +// open.c, stream.c #define MSGTR_CdDevNotfound "CDROM-Laufwerk '%s' nicht gefunden.\n" #define MSGTR_ErrTrackSelect "Fehler beim Auswählen des VCD Tracks." #define MSGTR_ReadSTDIN "Lese von Standardeingabe (stdin)...\n" @@ -584,7 +585,7 @@ static char help_text[]= #define MSGTR_DVDsubtitleLanguage "Untertitel ( sid ): %d Sprache: %s\n" #define MSGTR_DVDnumSubtitles "Anzahl der Untertitel auf der Disc: %d\n" -// muxer.c, muxer_*.c: +// muxer.c, muxer_*.c #define MSGTR_TooManyStreams "Zu viele Streams!" #define MSGTR_RawMuxerOnlyOneStream "Der rawaudio-Muxer unterstützt nur einen Audiostream!\n" #define MSGTR_IgnoringVideoStream "Ignoriere Videostream!\n" @@ -597,7 +598,7 @@ static char help_text[]= #define MSGTR_WritingHeader "Schreibe Dateikopf...\n" #define MSGTR_WritingTrailer "Schreibe Dateiindex...\n" -// demuxer.c, demux_*.c: +// demuxer.c, demux_*.c #define MSGTR_AudioStreamRedefined "Warnung! Audiostream-Header %d neu definiert!\n" #define MSGTR_VideoStreamRedefined "Warnung! Videostream-Header %d neu definiert!\n" #define MSGTR_TooManyAudioInBuffer "\nZu viele Audiopakete im Puffer: (%d in %d Bytes).\n" @@ -664,7 +665,7 @@ static char help_text[]= #define MSGTR_AudioID "[%s] Audiostream gefunden, -aid %d\n" #define MSGTR_SubtitleID "[%s] Untertitelstream gefunden, -sid %d\n" -// dec_video.c & dec_audio.c: +// dec_video.c & dec_audio.c #define MSGTR_CantOpenCodec "Konnte Codec nicht öffnen.\n" #define MSGTR_CantCloseCodec "Konnte Codec nicht schließen.\n" diff --git a/libswscale/Makefile b/libswscale/Makefile index 9ebe825266..6d500abc65 100644 --- a/libswscale/Makefile +++ b/libswscale/Makefile @@ -5,7 +5,7 @@ FFLIBS = avutil HEADERS = swscale.h -OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb2.o +OBJS = rgb2rgb.o swscale.o swscale_avoption.o yuv2rgb.o OBJS-$(ARCH_BFIN) += internal_bfin.o swscale_bfin.o yuv2rgb_bfin.o OBJS-$(CONFIG_MLIB) += yuv2rgb_mlib.o diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index fe90a04f22..53a0d4e7b8 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -1,32 +1,27 @@ /* - * software YUV to RGB converter + * software YUV to RGB converter * - * Copyright (C) 1999, Aaron Holtzman <aholtzma@ess.engr.uvic.ca> + * Copyright (C) 2009 Konstantin Shishkov * - * Functions broken out from display_x11.c and several new modes - * added by Håkan Hjort <d95hjort@dtek.chalmers.se> + * MMX/MMX2 template stuff (needed for fast movntq support), + * 1,4,8bpp support and context / deglobalize stuff + * by Michael Niedermayer (michaelni@gmx.at) * - * 15 & 16 bpp support by Franck Sicard <Franck.Sicard@solsoft.fr> + * This file is part of FFmpeg. * - * MMX/MMX2 template stuff (needed for fast movntq support), - * 1,4,8bpp support and context / deglobalize stuff - * by Michael Niedermayer (michaelni@gmx.at) + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This file is part of mpeg2dec, a free MPEG-2 video decoder + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * mpeg2dec is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * mpeg2dec is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with mpeg2dec; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdio.h> @@ -45,7 +40,7 @@ extern const uint8_t dither_8x8_32[8][8]; extern const uint8_t dither_8x8_73[8][8]; extern const uint8_t dither_8x8_220[8][8]; -#if HAVE_MMX +#if HAVE_MMX && CONFIG_GPL /* hope these constant values are cache line aligned */ DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL; @@ -68,7 +63,7 @@ DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL; #define RENAME(a) a ## _MMX2 #include "yuv2rgb_template.c" -#endif /* HAVE_MMX */ +#endif /* HAVE_MMX && CONFIG_GPL */ const int32_t ff_yuv2rgb_coeffs[8][4] = { {117504, 138453, 13954, 34903}, /* no sequence_display_extension */ @@ -81,73 +76,55 @@ const int32_t ff_yuv2rgb_coeffs[8][4] = { {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */ }; -#define RGB(i) \ +#define LOADCHROMA(i) \ U = pu[i]; \ V = pv[i]; \ r = (void *)c->table_rV[V]; \ g = (void *)(c->table_gU[U] + c->table_gV[V]); \ b = (void *)c->table_bU[U]; -#define DST1(i) \ - Y = py_1[2*i]; \ - dst_1[2*i] = r[Y] + g[Y] + b[Y]; \ - Y = py_1[2*i+1]; \ - dst_1[2*i+1] = r[Y] + g[Y] + b[Y]; - -#define DST2(i) \ - Y = py_2[2*i]; \ - dst_2[2*i] = r[Y] + g[Y] + b[Y]; \ - Y = py_2[2*i+1]; \ - dst_2[2*i+1] = r[Y] + g[Y] + b[Y]; - -#define DST1RGB(i) \ - Y = py_1[2*i]; \ - dst_1[6*i] = r[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = b[Y]; \ - Y = py_1[2*i+1]; \ - dst_1[6*i+3] = r[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = b[Y]; - -#define DST2RGB(i) \ - Y = py_2[2*i]; \ - dst_2[6*i] = r[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = b[Y]; \ - Y = py_2[2*i+1]; \ - dst_2[6*i+3] = r[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = b[Y]; - -#define DST1BGR(i) \ - Y = py_1[2*i]; \ - dst_1[6*i] = b[Y]; dst_1[6*i+1] = g[Y]; dst_1[6*i+2] = r[Y]; \ - Y = py_1[2*i+1]; \ - dst_1[6*i+3] = b[Y]; dst_1[6*i+4] = g[Y]; dst_1[6*i+5] = r[Y]; - -#define DST2BGR(i) \ - Y = py_2[2*i]; \ - dst_2[6*i] = b[Y]; dst_2[6*i+1] = g[Y]; dst_2[6*i+2] = r[Y]; \ - Y = py_2[2*i+1]; \ - dst_2[6*i+3] = b[Y]; dst_2[6*i+4] = g[Y]; dst_2[6*i+5] = r[Y]; - -#define PROLOG(func_name, dst_type) \ +#define PUTRGB(dst,src,i,o) \ + Y = src[2*i+o]; \ + dst[2*i ] = r[Y] + g[Y] + b[Y]; \ + Y = src[2*i+1-o]; \ + dst[2*i+1] = r[Y] + g[Y] + b[Y]; + +#define PUTRGB24(dst,src,i) \ + Y = src[2*i]; \ + dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \ + Y = src[2*i+1]; \ + dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y]; + +#define PUTBGR24(dst,src,i) \ + Y = src[2*i]; \ + dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \ + Y = src[2*i+1]; \ + dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y]; + +#define YUV2RGBFUNC(func_name, dst_type) \ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ int srcSliceH, uint8_t* dst[], int dstStride[]){\ int y;\ \ - if (c->srcFormat == PIX_FMT_YUV422P){\ + if (c->srcFormat == PIX_FMT_YUV422P) {\ srcStride[1] *= 2;\ srcStride[2] *= 2;\ }\ - for (y=0; y<srcSliceH; y+=2){\ - dst_type *dst_1= (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\ - dst_type *dst_2= (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\ + for (y=0; y<srcSliceH; y+=2) {\ + dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\ + dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\ dst_type av_unused *r, *b;\ dst_type *g;\ - uint8_t *py_1= src[0] + y*srcStride[0];\ - uint8_t *py_2= py_1 + srcStride[0];\ - uint8_t *pu= src[1] + (y>>1)*srcStride[1];\ - uint8_t *pv= src[2] + (y>>1)*srcStride[2];\ - unsigned int h_size= c->dstW>>3;\ + uint8_t *py_1 = src[0] + y*srcStride[0];\ + uint8_t *py_2 = py_1 + srcStride[0];\ + uint8_t *pu = src[1] + (y>>1)*srcStride[1];\ + uint8_t *pv = src[2] + (y>>1)*srcStride[2];\ + unsigned int h_size = c->dstW>>3;\ while (h_size--) {\ int av_unused U, V;\ int Y;\ -#define EPILOG1(dst_delta)\ +#define ENDYUV2RGBLINE(dst_delta)\ pu += 4;\ pv += 4;\ py_1 += 8;\ @@ -158,342 +135,311 @@ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSlic if (c->dstW & 4) {\ int av_unused Y, U, V;\ -#define EPILOG2()\ +#define ENDYUV2RGBFUNC()\ }\ }\ return srcSliceH;\ } -#define EPILOG(dst_delta)\ - EPILOG1(dst_delta)\ - EPILOG2() - -PROLOG(yuv2rgb_c_32, uint32_t) - RGB(0); - DST1(0); - DST2(0); - - RGB(1); - DST2(1); - DST1(1); - - RGB(2); - DST1(2); - DST2(2); - - RGB(3); - DST2(3); - DST1(3); -EPILOG1(8) - RGB(0); - DST1(0); - DST2(0); - - RGB(1); - DST2(1); - DST1(1); -EPILOG2() - -PROLOG(yuv2rgb_c_24_rgb, uint8_t) - RGB(0); - DST1RGB(0); - DST2RGB(0); - - RGB(1); - DST2RGB(1); - DST1RGB(1); - - RGB(2); - DST1RGB(2); - DST2RGB(2); - - RGB(3); - DST2RGB(3); - DST1RGB(3); -EPILOG1(24) - RGB(0); - DST1RGB(0); - DST2RGB(0); - - RGB(1); - DST2RGB(1); - DST1RGB(1); -EPILOG2() +#define CLOSEYUV2RGBFUNC(dst_delta)\ + ENDYUV2RGBLINE(dst_delta)\ + ENDYUV2RGBFUNC() + +YUV2RGBFUNC(yuv2rgb_c_32, uint32_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +ENDYUV2RGBLINE(8) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); +ENDYUV2RGBFUNC() + +YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t) + LOADCHROMA(0); + PUTRGB24(dst_1,py_1,0); + PUTRGB24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTRGB24(dst_2,py_2,1); + PUTRGB24(dst_1,py_1,1); + + LOADCHROMA(2); + PUTRGB24(dst_1,py_1,2); + PUTRGB24(dst_2,py_2,2); + + LOADCHROMA(3); + PUTRGB24(dst_2,py_2,3); + PUTRGB24(dst_1,py_1,3); +ENDYUV2RGBLINE(24) + LOADCHROMA(0); + PUTRGB24(dst_1,py_1,0); + PUTRGB24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTRGB24(dst_2,py_2,1); + PUTRGB24(dst_1,py_1,1); +ENDYUV2RGBFUNC() // only trivial mods from yuv2rgb_c_24_rgb -PROLOG(yuv2rgb_c_24_bgr, uint8_t) - RGB(0); - DST1BGR(0); - DST2BGR(0); - - RGB(1); - DST2BGR(1); - DST1BGR(1); - - RGB(2); - DST1BGR(2); - DST2BGR(2); - - RGB(3); - DST2BGR(3); - DST1BGR(3); -EPILOG1(24) - RGB(0); - DST1BGR(0); - DST2BGR(0); - - RGB(1); - DST2BGR(1); - DST1BGR(1); -EPILOG2() +YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t) + LOADCHROMA(0); + PUTBGR24(dst_1,py_1,0); + PUTBGR24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTBGR24(dst_2,py_2,1); + PUTBGR24(dst_1,py_1,1); + + LOADCHROMA(2); + PUTBGR24(dst_1,py_1,2); + PUTBGR24(dst_2,py_2,2); + + LOADCHROMA(3); + PUTBGR24(dst_2,py_2,3); + PUTBGR24(dst_1,py_1,3); +ENDYUV2RGBLINE(24) + LOADCHROMA(0); + PUTBGR24(dst_1,py_1,0); + PUTBGR24(dst_2,py_2,0); + + LOADCHROMA(1); + PUTBGR24(dst_2,py_2,1); + PUTBGR24(dst_1,py_1,1); +ENDYUV2RGBFUNC() // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -PROLOG(yuv2rgb_c_16, uint16_t) - RGB(0); - DST1(0); - DST2(0); +YUV2RGBFUNC(yuv2rgb_c_16, uint16_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); - RGB(1); - DST2(1); - DST1(1); + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); - RGB(2); - DST1(2); - DST2(2); + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); - RGB(3); - DST2(3); - DST1(3); -EPILOG(8) + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -PROLOG(yuv2rgb_c_8, uint8_t) - RGB(0); - DST1(0); - DST2(0); +YUV2RGBFUNC(yuv2rgb_c_8, uint8_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); - RGB(1); - DST2(1); - DST1(1); + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); - RGB(2); - DST1(2); - DST2(2); + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); - RGB(3); - DST2(3); - DST1(3); -EPILOG(8) + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) // r, g, b, dst_1, dst_2 -PROLOG(yuv2rgb_c_8_ordered_dither, uint8_t) - const uint8_t *d32= dither_8x8_32[y&7]; - const uint8_t *d64= dither_8x8_73[y&7]; -#define DST1bpp8(i,o) \ - Y = py_1[2*i]; \ - dst_1[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \ - Y = py_1[2*i+1]; \ - dst_1[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]]; - -#define DST2bpp8(i,o) \ - Y = py_2[2*i]; \ - dst_2[2*i] = r[Y+d32[8+o]] + g[Y+d32[8+o]] + b[Y+d64[8+o]]; \ - Y = py_2[2*i+1]; \ - dst_2[2*i+1] = r[Y+d32[9+o]] + g[Y+d32[9+o]] + b[Y+d64[9+o]]; +YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t) + const uint8_t *d32 = dither_8x8_32[y&7]; + const uint8_t *d64 = dither_8x8_73[y&7]; +#define PUTRGB8(dst,src,i,o) \ + Y = src[2*i]; \ + dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \ + Y = src[2*i+1]; \ + dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]]; + LOADCHROMA(0); + PUTRGB8(dst_1,py_1,0,0); + PUTRGB8(dst_2,py_2,0,0+8); - RGB(0); - DST1bpp8(0,0); - DST2bpp8(0,0); + LOADCHROMA(1); + PUTRGB8(dst_2,py_2,1,2+8); + PUTRGB8(dst_1,py_1,1,2); - RGB(1); - DST2bpp8(1,2); - DST1bpp8(1,2); + LOADCHROMA(2); + PUTRGB8(dst_1,py_1,2,4); + PUTRGB8(dst_2,py_2,2,4+8); - RGB(2); - DST1bpp8(2,4); - DST2bpp8(2,4); - - RGB(3); - DST2bpp8(3,6); - DST1bpp8(3,6); -EPILOG(8) + LOADCHROMA(3); + PUTRGB8(dst_2,py_2,3,6+8); + PUTRGB8(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(8) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -PROLOG(yuv2rgb_c_4, uint8_t) +YUV2RGBFUNC(yuv2rgb_c_4, uint8_t) int acc; -#define DST1_4(i) \ - Y = py_1[2*i]; \ +#define PUTRGB4(dst,src,i) \ + Y = src[2*i]; \ acc = r[Y] + g[Y] + b[Y]; \ - Y = py_1[2*i+1]; \ + Y = src[2*i+1]; \ acc |= (r[Y] + g[Y] + b[Y])<<4; \ - dst_1[i] = acc; + dst[i] = acc; -#define DST2_4(i) \ - Y = py_2[2*i]; \ - acc = r[Y] + g[Y] + b[Y]; \ - Y = py_2[2*i+1]; \ - acc |= (r[Y] + g[Y] + b[Y])<<4; \ - dst_2[i] = acc; + LOADCHROMA(0); + PUTRGB4(dst_1,py_1,0); + PUTRGB4(dst_2,py_2,0); - RGB(0); - DST1_4(0); - DST2_4(0); + LOADCHROMA(1); + PUTRGB4(dst_2,py_2,1); + PUTRGB4(dst_1,py_1,1); - RGB(1); - DST2_4(1); - DST1_4(1); + LOADCHROMA(2); + PUTRGB4(dst_1,py_1,2); + PUTRGB4(dst_2,py_2,2); - RGB(2); - DST1_4(2); - DST2_4(2); + LOADCHROMA(3); + PUTRGB4(dst_2,py_2,3); + PUTRGB4(dst_1,py_1,3); +CLOSEYUV2RGBFUNC(4) - RGB(3); - DST2_4(3); - DST1_4(3); -EPILOG(4) - -PROLOG(yuv2rgb_c_4_ordered_dither, uint8_t) - const uint8_t *d64= dither_8x8_73[y&7]; - const uint8_t *d128=dither_8x8_220[y&7]; +YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t) + const uint8_t *d64 = dither_8x8_73[y&7]; + const uint8_t *d128 = dither_8x8_220[y&7]; int acc; -#define DST1bpp4(i,o) \ - Y = py_1[2*i]; \ +#define PUTRGB4D(dst,src,i,o) \ + Y = src[2*i]; \ acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ - Y = py_1[2*i+1]; \ + Y = src[2*i+1]; \ acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \ - dst_1[i]= acc; - -#define DST2bpp4(i,o) \ - Y = py_2[2*i]; \ - acc = r[Y+d128[8+o]] + g[Y+d64[8+o]] + b[Y+d128[8+o]]; \ - Y = py_2[2*i+1]; \ - acc |= (r[Y+d128[9+o]] + g[Y+d64[9+o]] + b[Y+d128[9+o]])<<4; \ - dst_2[i]= acc; - + dst[i]= acc; - RGB(0); - DST1bpp4(0,0); - DST2bpp4(0,0); + LOADCHROMA(0); + PUTRGB4D(dst_1,py_1,0,0); + PUTRGB4D(dst_2,py_2,0,0+8); - RGB(1); - DST2bpp4(1,2); - DST1bpp4(1,2); + LOADCHROMA(1); + PUTRGB4D(dst_2,py_2,1,2+8); + PUTRGB4D(dst_1,py_1,1,2); - RGB(2); - DST1bpp4(2,4); - DST2bpp4(2,4); + LOADCHROMA(2); + PUTRGB4D(dst_1,py_1,2,4); + PUTRGB4D(dst_2,py_2,2,4+8); - RGB(3); - DST2bpp4(3,6); - DST1bpp4(3,6); -EPILOG(4) + LOADCHROMA(3); + PUTRGB4D(dst_2,py_2,3,6+8); + PUTRGB4D(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(4) // This is exactly the same code as yuv2rgb_c_32 except for the types of // r, g, b, dst_1, dst_2 -PROLOG(yuv2rgb_c_4b, uint8_t) - RGB(0); - DST1(0); - DST2(0); - - RGB(1); - DST2(1); - DST1(1); - - RGB(2); - DST1(2); - DST2(2); - - RGB(3); - DST2(3); - DST1(3); -EPILOG(8) - -PROLOG(yuv2rgb_c_4b_ordered_dither, uint8_t) - const uint8_t *d64= dither_8x8_73[y&7]; - const uint8_t *d128=dither_8x8_220[y&7]; - -#define DST1bpp4b(i,o) \ - Y = py_1[2*i]; \ - dst_1[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ - Y = py_1[2*i+1]; \ - dst_1[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]]; - -#define DST2bpp4b(i,o) \ - Y = py_2[2*i]; \ - dst_2[2*i] = r[Y+d128[8+o]] + g[Y+d64[8+o]] + b[Y+d128[8+o]]; \ - Y = py_2[2*i+1]; \ - dst_2[2*i+1] = r[Y+d128[9+o]] + g[Y+d64[9+o]] + b[Y+d128[9+o]]; - - - RGB(0); - DST1bpp4b(0,0); - DST2bpp4b(0,0); - - RGB(1); - DST2bpp4b(1,2); - DST1bpp4b(1,2); - - RGB(2); - DST1bpp4b(2,4); - DST2bpp4b(2,4); - - RGB(3); - DST2bpp4b(3,6); - DST1bpp4b(3,6); -EPILOG(8) - -PROLOG(yuv2rgb_c_1_ordered_dither, uint8_t) - const uint8_t *d128=dither_8x8_220[y&7]; - char out_1=0, out_2=0; +YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t) + LOADCHROMA(0); + PUTRGB(dst_1,py_1,0,0); + PUTRGB(dst_2,py_2,0,1); + + LOADCHROMA(1); + PUTRGB(dst_2,py_2,1,1); + PUTRGB(dst_1,py_1,1,0); + + LOADCHROMA(2); + PUTRGB(dst_1,py_1,2,0); + PUTRGB(dst_2,py_2,2,1); + + LOADCHROMA(3); + PUTRGB(dst_2,py_2,3,1); + PUTRGB(dst_1,py_1,3,0); +CLOSEYUV2RGBFUNC(8) + +YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t) + const uint8_t *d64 = dither_8x8_73[y&7]; + const uint8_t *d128 = dither_8x8_220[y&7]; + +#define PUTRGB4DB(dst,src,i,o) \ + Y = src[2*i]; \ + dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ + Y = src[2*i+1]; \ + dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]]; + + LOADCHROMA(0); + PUTRGB4DB(dst_1,py_1,0,0); + PUTRGB4DB(dst_2,py_2,0,0+8); + + LOADCHROMA(1); + PUTRGB4DB(dst_2,py_2,1,2+8); + PUTRGB4DB(dst_1,py_1,1,2); + + LOADCHROMA(2); + PUTRGB4DB(dst_1,py_1,2,4); + PUTRGB4DB(dst_2,py_2,2,4+8); + + LOADCHROMA(3); + PUTRGB4DB(dst_2,py_2,3,6+8); + PUTRGB4DB(dst_1,py_1,3,6); +CLOSEYUV2RGBFUNC(8) + +YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t) + const uint8_t *d128 = dither_8x8_220[y&7]; + char out_1 = 0, out_2 = 0; g= c->table_gU[128] + c->table_gV[128]; -#define DST1bpp1(i,o) \ - Y = py_1[2*i]; \ - out_1+= out_1 + g[Y+d128[0+o]]; \ - Y = py_1[2*i+1]; \ - out_1+= out_1 + g[Y+d128[1+o]]; +#define PUTRGB1(out,src,i,o) \ + Y = src[2*i]; \ + out+= out + g[Y+d128[0+o]]; \ + Y = src[2*i+1]; \ + out+= out + g[Y+d128[1+o]]; -#define DST2bpp1(i,o) \ - Y = py_2[2*i]; \ - out_2+= out_2 + g[Y+d128[8+o]]; \ - Y = py_2[2*i+1]; \ - out_2+= out_2 + g[Y+d128[9+o]]; + PUTRGB1(out_1,py_1,0,0); + PUTRGB1(out_2,py_2,0,0+8); - DST1bpp1(0,0); - DST2bpp1(0,0); + PUTRGB1(out_2,py_2,1,2+8); + PUTRGB1(out_1,py_1,1,2); - DST2bpp1(1,2); - DST1bpp1(1,2); + PUTRGB1(out_1,py_1,2,4); + PUTRGB1(out_2,py_2,2,4+8); - DST1bpp1(2,4); - DST2bpp1(2,4); - - DST2bpp1(3,6); - DST1bpp1(3,6); + PUTRGB1(out_2,py_2,3,6+8); + PUTRGB1(out_1,py_1,3,6); dst_1[0]= out_1; dst_2[0]= out_2; -EPILOG(1) +CLOSEYUV2RGBFUNC(1) -SwsFunc sws_yuv2rgb_get_func_ptr (SwsContext *c) +SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) { -#if HAVE_MMX2 || HAVE_MMX - if (c->flags & SWS_CPU_CAPS_MMX2){ - switch(c->dstFormat){ + SwsFunc t = NULL; +#if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL + if (c->flags & SWS_CPU_CAPS_MMX2) { + switch (c->dstFormat) { case PIX_FMT_RGB32: return yuv420_rgb32_MMX2; case PIX_FMT_BGR24: return yuv420_rgb24_MMX2; case PIX_FMT_RGB565: return yuv420_rgb16_MMX2; case PIX_FMT_RGB555: return yuv420_rgb15_MMX2; } } - if (c->flags & SWS_CPU_CAPS_MMX){ - switch(c->dstFormat){ + if (c->flags & SWS_CPU_CAPS_MMX) { + switch (c->dstFormat) { case PIX_FMT_RGB32: return yuv420_rgb32_MMX; case PIX_FMT_BGR24: return yuv420_rgb24_MMX; case PIX_FMT_RGB565: return yuv420_rgb16_MMX; @@ -502,50 +448,41 @@ SwsFunc sws_yuv2rgb_get_func_ptr (SwsContext *c) } #endif #if HAVE_VIS - { - SwsFunc t= sws_yuv2rgb_init_vis(c); - if (t) return t; - } + t = sws_yuv2rgb_init_vis(c); #endif #if CONFIG_MLIB - { - SwsFunc t= sws_yuv2rgb_init_mlib(c); - if (t) return t; - } + t = sws_yuv2rgb_init_mlib(c); #endif -#if HAVE_ALTIVEC +#if HAVE_ALTIVEC && CONFIG_GPL if (c->flags & SWS_CPU_CAPS_ALTIVEC) - { - SwsFunc t = sws_yuv2rgb_init_altivec(c); - if (t) return t; - } + t = sws_yuv2rgb_init_altivec(c); #endif #if ARCH_BFIN if (c->flags & SWS_CPU_CAPS_BFIN) - { - SwsFunc t = ff_bfin_yuv2rgb_get_func_ptr (c); - if (t) return t; - } + t = sws_ff_bfin_yuv2rgb_get_func_ptr(c); #endif + if (t) + return t; + av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found.\n"); - switch(c->dstFormat){ + switch (c->dstFormat) { case PIX_FMT_BGR32_1: case PIX_FMT_RGB32_1: case PIX_FMT_BGR32: - case PIX_FMT_RGB32: return yuv2rgb_c_32; - case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb; - case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr; + case PIX_FMT_RGB32: return yuv2rgb_c_32; + case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb; + case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr; case PIX_FMT_RGB565: case PIX_FMT_BGR565: case PIX_FMT_RGB555: - case PIX_FMT_BGR555: return yuv2rgb_c_16; + case PIX_FMT_BGR555: return yuv2rgb_c_16; case PIX_FMT_RGB8: - case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither; + case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither; case PIX_FMT_RGB4: - case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither; + case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither; case PIX_FMT_RGB4_BYTE: case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither; case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither; @@ -555,15 +492,33 @@ SwsFunc sws_yuv2rgb_get_func_ptr (SwsContext *c) return NULL; } -static int div_round (int dividend, int divisor) +static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table) +{ + int i; + int64_t cb = 0; + + y_table -= elemsize * (inc >> 9); + + for (i = 0; i < 256; i++) { + table[i] = y_table + elemsize * (cb >> 16); + cb += inc; + } +} + +static void fill_gv_table(int table[256], const int elemsize, const int inc) { - if (dividend > 0) - return (dividend + (divisor>>1)) / divisor; - else - return -((-dividend + (divisor>>1)) / divisor); + int i; + int64_t cb = 0; + int off = -(inc >> 9); + + for (i = 0; i < 256; i++) { + table[i] = elemsize * (off + (cb >> 16)); + cb += inc; + } } -int sws_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) +av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, + int brightness, int contrast, int saturation) { const int isRgb = c->dstFormat==PIX_FMT_RGB32 || c->dstFormat==PIX_FMT_RGB32_1 @@ -575,17 +530,11 @@ int sws_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRa || c->dstFormat==PIX_FMT_RGB4_BYTE || c->dstFormat==PIX_FMT_MONOBLACK; const int bpp = fmt_depth(c->dstFormat); - int i, base; - uint8_t table_Y[1024]; - uint32_t *table_32 = 0; - uint16_t *table_16 = 0; - uint8_t *table_8 = 0; - uint8_t *table_332 = 0; - uint8_t *table_121 = 0; - uint8_t *table_1 = 0; - int entry_size = 0; - void *table_r = 0, *table_g = 0, *table_b = 0; - void *table_start; + uint8_t *y_table; + uint16_t *y_table16; + uint32_t *y_table32; + int i, base, rbase, gbase, bbase; + const int yoffs = fullRange ? 384 : 326; int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; @@ -594,187 +543,141 @@ int sws_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRa int64_t cy = 1<<16; int64_t oy = 0; -//printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv); - if (!fullRange){ - cy= (cy*255) / 219; - oy= 16<<16; - }else{ - crv= (crv*224) / 255; - cbu= (cbu*224) / 255; - cgu= (cgu*224) / 255; - cgv= (cgv*224) / 255; + int64_t yb = 0; + + if (!fullRange) { + cy = (cy*255) / 219; + oy = 16<<16; + } else { + crv = (crv*224) / 255; + cbu = (cbu*224) / 255; + cgu = (cgu*224) / 255; + cgv = (cgv*224) / 255; } - cy = (cy *contrast )>>16; - crv= (crv*contrast * saturation)>>32; - cbu= (cbu*contrast * saturation)>>32; - cgu= (cgu*contrast * saturation)>>32; - cgv= (cgv*contrast * saturation)>>32; -//printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv); + cy = (cy *contrast ) >> 16; + crv = (crv*contrast * saturation) >> 32; + cbu = (cbu*contrast * saturation) >> 32; + cgu = (cgu*contrast * saturation) >> 32; + cgv = (cgv*contrast * saturation) >> 32; oy -= 256*brightness; - for (i = 0; i < 1024; i++) { - int j; + //scale coefficients by cy + crv = ((crv << 16) + 0x8000) / cy; + cbu = ((cbu << 16) + 0x8000) / cy; + cgu = ((cgu << 16) + 0x8000) / cy; + cgv = ((cgv << 16) + 0x8000) / cy; - j= (cy*(((i - 384)<<16) - oy) + (1<<31))>>32; - j = (j < 0) ? 0 : ((j > 255) ? 255 : j); - table_Y[i] = j; - } + av_free(c->yuvTable); switch (bpp) { - case 32: - table_start= table_32 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint32_t)); - base= (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0; - - entry_size = sizeof (uint32_t); - table_r = table_32 + 197; - table_b = table_32 + 197 + 685; - table_g = table_32 + 197 + 2*682; - - for (i = -197; i < 256+197; i++) - ((uint32_t *)table_r)[i] = table_Y[i+384] << ((isRgb ? 16 : 0) + base); - for (i = -132; i < 256+132; i++) - ((uint32_t *)table_g)[i] = table_Y[i+384] << (8 + base); - for (i = -232; i < 256+232; i++) - ((uint32_t *)table_b)[i] = table_Y[i+384] << ((isRgb ? 0 : 16) + base); - break; - - case 24: - table_start= table_8 = av_malloc ((256 + 2*232) * sizeof (uint8_t)); - - entry_size = sizeof (uint8_t); - table_r = table_g = table_b = table_8 + 232; - - for (i = -232; i < 256+232; i++) - ((uint8_t * )table_b)[i] = table_Y[i+384]; - break; - - case 15: - case 16: - table_start= table_16 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint16_t)); - - entry_size = sizeof (uint16_t); - table_r = table_16 + 197; - table_b = table_16 + 197 + 685; - table_g = table_16 + 197 + 2*682; - - for (i = -197; i < 256+197; i++) { - int j = table_Y[i+384] >> 3; - - if (isRgb) - j <<= ((bpp==16) ? 11 : 10); - - ((uint16_t *)table_r)[i] = j; - } - for (i = -132; i < 256+132; i++) { - int j = table_Y[i+384] >> ((bpp==16) ? 2 : 3); - - ((uint16_t *)table_g)[i] = j << 5; + case 1: + c->yuvTable = av_malloc(1024); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-110; i++) { + y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7; + yb += cy; } - for (i = -232; i < 256+232; i++) { - int j = table_Y[i+384] >> 3; - - if (!isRgb) - j <<= ((bpp==16) ? 11 : 10); - - ((uint16_t *)table_b)[i] = j; + fill_table(c->table_gU, 1, cgu, y_table + yoffs); + fill_gv_table(c->table_gV, 1, cgv); + break; + case 4: + case 4|128: + rbase = isRgb ? 3 : 0; + gbase = 1; + bbase = isRgb ? 0 : 3; + c->yuvTable = av_malloc(1024*3); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-110; i++) { + int yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table[i+110 ] = (yval >> 7) << rbase; + y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase; + y_table[i+110+2048] = (yval >> 7) << bbase; + yb += cy; } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); + fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); + fill_gv_table(c->table_gV, 1, cgv); break; - case 8: - table_start= table_332 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); - - entry_size = sizeof (uint8_t); - table_r = table_332 + 197; - table_b = table_332 + 197 + 685; - table_g = table_332 + 197 + 2*682; - - for (i = -197; i < 256+197; i++) { - int j = (table_Y[i+384 - 16] + 18)/36; - - if (isRgb) - j <<= 5; - - ((uint8_t *)table_r)[i] = j; - } - for (i = -132; i < 256+132; i++) { - int j = (table_Y[i+384 - 16] + 18)/36; - - if (!isRgb) - j <<= 1; - - ((uint8_t *)table_g)[i] = j << 2; - } - for (i = -232; i < 256+232; i++) { - int j = (table_Y[i+384 - 37] + 43)/85; - - if (!isRgb) - j <<= 6; - - ((uint8_t *)table_b)[i] = j; + rbase = isRgb ? 5 : 0; + gbase = isRgb ? 2 : 3; + bbase = isRgb ? 0 : 6; + c->yuvTable = av_malloc(1024*3); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024-38; i++) { + int yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table[i+16 ] = ((yval + 18) / 36) << rbase; + y_table[i+16+1024] = ((yval + 18) / 36) << gbase; + y_table[i+37+2048] = ((yval + 43) / 85) << bbase; + yb += cy; } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); + fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); + fill_gv_table(c->table_gV, 1, cgv); break; - case 4: - case 4|128: - table_start= table_121 = av_malloc ((197 + 2*682 + 256 + 132) * sizeof (uint8_t)); - - entry_size = sizeof (uint8_t); - table_r = table_121 + 197; - table_b = table_121 + 197 + 685; - table_g = table_121 + 197 + 2*682; - - for (i = -197; i < 256+197; i++) { - int j = table_Y[i+384 - 110] >> 7; - - if (isRgb) - j <<= 3; - - ((uint8_t *)table_r)[i] = j; - } - for (i = -132; i < 256+132; i++) { - int j = (table_Y[i+384 - 37]+ 43)/85; - - ((uint8_t *)table_g)[i] = j << 1; + case 15: + case 16: + rbase = isRgb ? bpp - 5 : 0; + gbase = 5; + bbase = isRgb ? 0 : (bpp - 5); + c->yuvTable = av_malloc(1024*3*2); + y_table16 = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table16[i ] = (yval >> 3) << rbase; + y_table16[i+1024] = (yval >> (18 - bpp)) << gbase; + y_table16[i+2048] = (yval >> 3) << bbase; + yb += cy; } - for (i = -232; i < 256+232; i++) { - int j =table_Y[i+384 - 110] >> 7; - - if (!isRgb) - j <<= 3; - - ((uint8_t *)table_b)[i] = j; + fill_table(c->table_rV, 2, crv, y_table16 + yoffs); + fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); + fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); + fill_gv_table(c->table_gV, 2, cgv); + break; + case 24: + c->yuvTable = av_malloc(1024); + y_table = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + y_table[i] = av_clip_uint8((yb + 0x8000) >> 16); + yb += cy; } + fill_table(c->table_rV, 1, crv, y_table + yoffs); + fill_table(c->table_gU, 1, cgu, y_table + yoffs); + fill_table(c->table_bU, 1, cbu, y_table + yoffs); + fill_gv_table(c->table_gV, 1, cgv); break; - - case 1: - table_start= table_1 = av_malloc (256*2 * sizeof (uint8_t)); - - entry_size = sizeof (uint8_t); - table_g = table_1; - table_r = table_b = NULL; - - for (i = 0; i < 256+256; i++) { - int j = table_Y[i + 384 - 110]>>7; - - ((uint8_t *)table_g)[i] = j; + case 32: + base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0; + rbase = base + (isRgb ? 16 : 0); + gbase = base + 8; + bbase = base + (isRgb ? 0 : 16); + c->yuvTable = av_malloc(1024*3*4); + y_table32 = c->yuvTable; + yb = -(384<<16) - oy; + for (i = 0; i < 1024; i++) { + uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); + y_table32[i ] = yval << rbase; + y_table32[i+1024] = yval << gbase; + y_table32[i+2048] = yval << bbase; + yb += cy; } + fill_table(c->table_rV, 4, crv, y_table32 + yoffs); + fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024); + fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048); + fill_gv_table(c->table_gV, 4, cgv); break; - default: - table_start= NULL; + c->yuvTable = NULL; av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); - //free mem? return -1; } - - for (i = 0; i < 256; i++) { - c->table_rV[i] = (uint8_t *)table_r + entry_size * div_round (crv * (i-128), cy); - c->table_gU[i] = (uint8_t *)table_g + entry_size * div_round (cgu * (i-128), cy); - c->table_gV[i] = entry_size * div_round (cgv * (i-128), cy); - c->table_bU[i] = (uint8_t *)table_b + entry_size * div_round (cbu * (i-128), cy); - } - - av_free(c->yuvTable); - c->yuvTable= table_start; return 0; } diff --git a/libswscale/yuv2rgb2.c b/libswscale/yuv2rgb2.c deleted file mode 100644 index 53a0d4e7b8..0000000000 --- a/libswscale/yuv2rgb2.c +++ /dev/null @@ -1,683 +0,0 @@ -/* - * software YUV to RGB converter - * - * Copyright (C) 2009 Konstantin Shishkov - * - * MMX/MMX2 template stuff (needed for fast movntq support), - * 1,4,8bpp support and context / deglobalize stuff - * by Michael Niedermayer (michaelni@gmx.at) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <stdio.h> -#include <stdlib.h> -#include <inttypes.h> -#include <assert.h> - -#include "config.h" -#include "rgb2rgb.h" -#include "swscale.h" -#include "swscale_internal.h" - -#define DITHER1XBPP // only for MMX - -extern const uint8_t dither_8x8_32[8][8]; -extern const uint8_t dither_8x8_73[8][8]; -extern const uint8_t dither_8x8_220[8][8]; - -#if HAVE_MMX && CONFIG_GPL - -/* hope these constant values are cache line aligned */ -DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL; -DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL; -DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL; - -//MMX versions -#undef RENAME -#undef HAVE_MMX2 -#undef HAVE_AMD3DNOW -#define HAVE_MMX2 0 -#define HAVE_AMD3DNOW 0 -#define RENAME(a) a ## _MMX -#include "yuv2rgb_template.c" - -//MMX2 versions -#undef RENAME -#undef HAVE_MMX2 -#define HAVE_MMX2 1 -#define RENAME(a) a ## _MMX2 -#include "yuv2rgb_template.c" - -#endif /* HAVE_MMX && CONFIG_GPL */ - -const int32_t ff_yuv2rgb_coeffs[8][4] = { - {117504, 138453, 13954, 34903}, /* no sequence_display_extension */ - {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */ - {104597, 132201, 25675, 53279}, /* unspecified */ - {104597, 132201, 25675, 53279}, /* reserved */ - {104448, 132798, 24759, 53109}, /* FCC */ - {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */ - {104597, 132201, 25675, 53279}, /* SMPTE 170M */ - {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */ -}; - -#define LOADCHROMA(i) \ - U = pu[i]; \ - V = pv[i]; \ - r = (void *)c->table_rV[V]; \ - g = (void *)(c->table_gU[U] + c->table_gV[V]); \ - b = (void *)c->table_bU[U]; - -#define PUTRGB(dst,src,i,o) \ - Y = src[2*i+o]; \ - dst[2*i ] = r[Y] + g[Y] + b[Y]; \ - Y = src[2*i+1-o]; \ - dst[2*i+1] = r[Y] + g[Y] + b[Y]; - -#define PUTRGB24(dst,src,i) \ - Y = src[2*i]; \ - dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \ - Y = src[2*i+1]; \ - dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y]; - -#define PUTBGR24(dst,src,i) \ - Y = src[2*i]; \ - dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \ - Y = src[2*i+1]; \ - dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y]; - -#define YUV2RGBFUNC(func_name, dst_type) \ -static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \ - int srcSliceH, uint8_t* dst[], int dstStride[]){\ - int y;\ -\ - if (c->srcFormat == PIX_FMT_YUV422P) {\ - srcStride[1] *= 2;\ - srcStride[2] *= 2;\ - }\ - for (y=0; y<srcSliceH; y+=2) {\ - dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\ - dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\ - dst_type av_unused *r, *b;\ - dst_type *g;\ - uint8_t *py_1 = src[0] + y*srcStride[0];\ - uint8_t *py_2 = py_1 + srcStride[0];\ - uint8_t *pu = src[1] + (y>>1)*srcStride[1];\ - uint8_t *pv = src[2] + (y>>1)*srcStride[2];\ - unsigned int h_size = c->dstW>>3;\ - while (h_size--) {\ - int av_unused U, V;\ - int Y;\ - -#define ENDYUV2RGBLINE(dst_delta)\ - pu += 4;\ - pv += 4;\ - py_1 += 8;\ - py_2 += 8;\ - dst_1 += dst_delta;\ - dst_2 += dst_delta;\ - }\ - if (c->dstW & 4) {\ - int av_unused Y, U, V;\ - -#define ENDYUV2RGBFUNC()\ - }\ - }\ - return srcSliceH;\ -} - -#define CLOSEYUV2RGBFUNC(dst_delta)\ - ENDYUV2RGBLINE(dst_delta)\ - ENDYUV2RGBFUNC() - -YUV2RGBFUNC(yuv2rgb_c_32, uint32_t) - LOADCHROMA(0); - PUTRGB(dst_1,py_1,0,0); - PUTRGB(dst_2,py_2,0,1); - - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); - - LOADCHROMA(2); - PUTRGB(dst_1,py_1,2,0); - PUTRGB(dst_2,py_2,2,1); - - LOADCHROMA(3); - PUTRGB(dst_2,py_2,3,1); - PUTRGB(dst_1,py_1,3,0); -ENDYUV2RGBLINE(8) - LOADCHROMA(0); - PUTRGB(dst_1,py_1,0,0); - PUTRGB(dst_2,py_2,0,1); - - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); -ENDYUV2RGBFUNC() - -YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t) - LOADCHROMA(0); - PUTRGB24(dst_1,py_1,0); - PUTRGB24(dst_2,py_2,0); - - LOADCHROMA(1); - PUTRGB24(dst_2,py_2,1); - PUTRGB24(dst_1,py_1,1); - - LOADCHROMA(2); - PUTRGB24(dst_1,py_1,2); - PUTRGB24(dst_2,py_2,2); - - LOADCHROMA(3); - PUTRGB24(dst_2,py_2,3); - PUTRGB24(dst_1,py_1,3); -ENDYUV2RGBLINE(24) - LOADCHROMA(0); - PUTRGB24(dst_1,py_1,0); - PUTRGB24(dst_2,py_2,0); - - LOADCHROMA(1); - PUTRGB24(dst_2,py_2,1); - PUTRGB24(dst_1,py_1,1); -ENDYUV2RGBFUNC() - -// only trivial mods from yuv2rgb_c_24_rgb -YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t) - LOADCHROMA(0); - PUTBGR24(dst_1,py_1,0); - PUTBGR24(dst_2,py_2,0); - - LOADCHROMA(1); - PUTBGR24(dst_2,py_2,1); - PUTBGR24(dst_1,py_1,1); - - LOADCHROMA(2); - PUTBGR24(dst_1,py_1,2); - PUTBGR24(dst_2,py_2,2); - - LOADCHROMA(3); - PUTBGR24(dst_2,py_2,3); - PUTBGR24(dst_1,py_1,3); -ENDYUV2RGBLINE(24) - LOADCHROMA(0); - PUTBGR24(dst_1,py_1,0); - PUTBGR24(dst_2,py_2,0); - - LOADCHROMA(1); - PUTBGR24(dst_2,py_2,1); - PUTBGR24(dst_1,py_1,1); -ENDYUV2RGBFUNC() - -// This is exactly the same code as yuv2rgb_c_32 except for the types of -// r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_16, uint16_t) - LOADCHROMA(0); - PUTRGB(dst_1,py_1,0,0); - PUTRGB(dst_2,py_2,0,1); - - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); - - LOADCHROMA(2); - PUTRGB(dst_1,py_1,2,0); - PUTRGB(dst_2,py_2,2,1); - - LOADCHROMA(3); - PUTRGB(dst_2,py_2,3,1); - PUTRGB(dst_1,py_1,3,0); -CLOSEYUV2RGBFUNC(8) - -// This is exactly the same code as yuv2rgb_c_32 except for the types of -// r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_8, uint8_t) - LOADCHROMA(0); - PUTRGB(dst_1,py_1,0,0); - PUTRGB(dst_2,py_2,0,1); - - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); - - LOADCHROMA(2); - PUTRGB(dst_1,py_1,2,0); - PUTRGB(dst_2,py_2,2,1); - - LOADCHROMA(3); - PUTRGB(dst_2,py_2,3,1); - PUTRGB(dst_1,py_1,3,0); -CLOSEYUV2RGBFUNC(8) - -// r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t) - const uint8_t *d32 = dither_8x8_32[y&7]; - const uint8_t *d64 = dither_8x8_73[y&7]; -#define PUTRGB8(dst,src,i,o) \ - Y = src[2*i]; \ - dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \ - Y = src[2*i+1]; \ - dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]]; - - LOADCHROMA(0); - PUTRGB8(dst_1,py_1,0,0); - PUTRGB8(dst_2,py_2,0,0+8); - - LOADCHROMA(1); - PUTRGB8(dst_2,py_2,1,2+8); - PUTRGB8(dst_1,py_1,1,2); - - LOADCHROMA(2); - PUTRGB8(dst_1,py_1,2,4); - PUTRGB8(dst_2,py_2,2,4+8); - - LOADCHROMA(3); - PUTRGB8(dst_2,py_2,3,6+8); - PUTRGB8(dst_1,py_1,3,6); -CLOSEYUV2RGBFUNC(8) - - -// This is exactly the same code as yuv2rgb_c_32 except for the types of -// r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_4, uint8_t) - int acc; -#define PUTRGB4(dst,src,i) \ - Y = src[2*i]; \ - acc = r[Y] + g[Y] + b[Y]; \ - Y = src[2*i+1]; \ - acc |= (r[Y] + g[Y] + b[Y])<<4; \ - dst[i] = acc; - - LOADCHROMA(0); - PUTRGB4(dst_1,py_1,0); - PUTRGB4(dst_2,py_2,0); - - LOADCHROMA(1); - PUTRGB4(dst_2,py_2,1); - PUTRGB4(dst_1,py_1,1); - - LOADCHROMA(2); - PUTRGB4(dst_1,py_1,2); - PUTRGB4(dst_2,py_2,2); - - LOADCHROMA(3); - PUTRGB4(dst_2,py_2,3); - PUTRGB4(dst_1,py_1,3); -CLOSEYUV2RGBFUNC(4) - -YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t) - const uint8_t *d64 = dither_8x8_73[y&7]; - const uint8_t *d128 = dither_8x8_220[y&7]; - int acc; - -#define PUTRGB4D(dst,src,i,o) \ - Y = src[2*i]; \ - acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ - Y = src[2*i+1]; \ - acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \ - dst[i]= acc; - - LOADCHROMA(0); - PUTRGB4D(dst_1,py_1,0,0); - PUTRGB4D(dst_2,py_2,0,0+8); - - LOADCHROMA(1); - PUTRGB4D(dst_2,py_2,1,2+8); - PUTRGB4D(dst_1,py_1,1,2); - - LOADCHROMA(2); - PUTRGB4D(dst_1,py_1,2,4); - PUTRGB4D(dst_2,py_2,2,4+8); - - LOADCHROMA(3); - PUTRGB4D(dst_2,py_2,3,6+8); - PUTRGB4D(dst_1,py_1,3,6); -CLOSEYUV2RGBFUNC(4) - -// This is exactly the same code as yuv2rgb_c_32 except for the types of -// r, g, b, dst_1, dst_2 -YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t) - LOADCHROMA(0); - PUTRGB(dst_1,py_1,0,0); - PUTRGB(dst_2,py_2,0,1); - - LOADCHROMA(1); - PUTRGB(dst_2,py_2,1,1); - PUTRGB(dst_1,py_1,1,0); - - LOADCHROMA(2); - PUTRGB(dst_1,py_1,2,0); - PUTRGB(dst_2,py_2,2,1); - - LOADCHROMA(3); - PUTRGB(dst_2,py_2,3,1); - PUTRGB(dst_1,py_1,3,0); -CLOSEYUV2RGBFUNC(8) - -YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t) - const uint8_t *d64 = dither_8x8_73[y&7]; - const uint8_t *d128 = dither_8x8_220[y&7]; - -#define PUTRGB4DB(dst,src,i,o) \ - Y = src[2*i]; \ - dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \ - Y = src[2*i+1]; \ - dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]]; - - LOADCHROMA(0); - PUTRGB4DB(dst_1,py_1,0,0); - PUTRGB4DB(dst_2,py_2,0,0+8); - - LOADCHROMA(1); - PUTRGB4DB(dst_2,py_2,1,2+8); - PUTRGB4DB(dst_1,py_1,1,2); - - LOADCHROMA(2); - PUTRGB4DB(dst_1,py_1,2,4); - PUTRGB4DB(dst_2,py_2,2,4+8); - - LOADCHROMA(3); - PUTRGB4DB(dst_2,py_2,3,6+8); - PUTRGB4DB(dst_1,py_1,3,6); -CLOSEYUV2RGBFUNC(8) - -YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t) - const uint8_t *d128 = dither_8x8_220[y&7]; - char out_1 = 0, out_2 = 0; - g= c->table_gU[128] + c->table_gV[128]; - -#define PUTRGB1(out,src,i,o) \ - Y = src[2*i]; \ - out+= out + g[Y+d128[0+o]]; \ - Y = src[2*i+1]; \ - out+= out + g[Y+d128[1+o]]; - - PUTRGB1(out_1,py_1,0,0); - PUTRGB1(out_2,py_2,0,0+8); - - PUTRGB1(out_2,py_2,1,2+8); - PUTRGB1(out_1,py_1,1,2); - - PUTRGB1(out_1,py_1,2,4); - PUTRGB1(out_2,py_2,2,4+8); - - PUTRGB1(out_2,py_2,3,6+8); - PUTRGB1(out_1,py_1,3,6); - - dst_1[0]= out_1; - dst_2[0]= out_2; -CLOSEYUV2RGBFUNC(1) - -SwsFunc sws_yuv2rgb_get_func_ptr(SwsContext *c) -{ - SwsFunc t = NULL; -#if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL - if (c->flags & SWS_CPU_CAPS_MMX2) { - switch (c->dstFormat) { - case PIX_FMT_RGB32: return yuv420_rgb32_MMX2; - case PIX_FMT_BGR24: return yuv420_rgb24_MMX2; - case PIX_FMT_RGB565: return yuv420_rgb16_MMX2; - case PIX_FMT_RGB555: return yuv420_rgb15_MMX2; - } - } - if (c->flags & SWS_CPU_CAPS_MMX) { - switch (c->dstFormat) { - case PIX_FMT_RGB32: return yuv420_rgb32_MMX; - case PIX_FMT_BGR24: return yuv420_rgb24_MMX; - case PIX_FMT_RGB565: return yuv420_rgb16_MMX; - case PIX_FMT_RGB555: return yuv420_rgb15_MMX; - } - } -#endif -#if HAVE_VIS - t = sws_yuv2rgb_init_vis(c); -#endif -#if CONFIG_MLIB - t = sws_yuv2rgb_init_mlib(c); -#endif -#if HAVE_ALTIVEC && CONFIG_GPL - if (c->flags & SWS_CPU_CAPS_ALTIVEC) - t = sws_yuv2rgb_init_altivec(c); -#endif - -#if ARCH_BFIN - if (c->flags & SWS_CPU_CAPS_BFIN) - t = sws_ff_bfin_yuv2rgb_get_func_ptr(c); -#endif - - if (t) - return t; - - av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found.\n"); - - switch (c->dstFormat) { - case PIX_FMT_BGR32_1: - case PIX_FMT_RGB32_1: - case PIX_FMT_BGR32: - case PIX_FMT_RGB32: return yuv2rgb_c_32; - case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb; - case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr; - case PIX_FMT_RGB565: - case PIX_FMT_BGR565: - case PIX_FMT_RGB555: - case PIX_FMT_BGR555: return yuv2rgb_c_16; - case PIX_FMT_RGB8: - case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither; - case PIX_FMT_RGB4: - case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither; - case PIX_FMT_RGB4_BYTE: - case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither; - case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither; - default: - assert(0); - } - return NULL; -} - -static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table) -{ - int i; - int64_t cb = 0; - - y_table -= elemsize * (inc >> 9); - - for (i = 0; i < 256; i++) { - table[i] = y_table + elemsize * (cb >> 16); - cb += inc; - } -} - -static void fill_gv_table(int table[256], const int elemsize, const int inc) -{ - int i; - int64_t cb = 0; - int off = -(inc >> 9); - - for (i = 0; i < 256; i++) { - table[i] = elemsize * (off + (cb >> 16)); - cb += inc; - } -} - -av_cold int sws_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, - int brightness, int contrast, int saturation) -{ - const int isRgb = c->dstFormat==PIX_FMT_RGB32 - || c->dstFormat==PIX_FMT_RGB32_1 - || c->dstFormat==PIX_FMT_BGR24 - || c->dstFormat==PIX_FMT_RGB565 - || c->dstFormat==PIX_FMT_RGB555 - || c->dstFormat==PIX_FMT_RGB8 - || c->dstFormat==PIX_FMT_RGB4 - || c->dstFormat==PIX_FMT_RGB4_BYTE - || c->dstFormat==PIX_FMT_MONOBLACK; - const int bpp = fmt_depth(c->dstFormat); - uint8_t *y_table; - uint16_t *y_table16; - uint32_t *y_table32; - int i, base, rbase, gbase, bbase; - const int yoffs = fullRange ? 384 : 326; - - int64_t crv = inv_table[0]; - int64_t cbu = inv_table[1]; - int64_t cgu = -inv_table[2]; - int64_t cgv = -inv_table[3]; - int64_t cy = 1<<16; - int64_t oy = 0; - - int64_t yb = 0; - - if (!fullRange) { - cy = (cy*255) / 219; - oy = 16<<16; - } else { - crv = (crv*224) / 255; - cbu = (cbu*224) / 255; - cgu = (cgu*224) / 255; - cgv = (cgv*224) / 255; - } - - cy = (cy *contrast ) >> 16; - crv = (crv*contrast * saturation) >> 32; - cbu = (cbu*contrast * saturation) >> 32; - cgu = (cgu*contrast * saturation) >> 32; - cgv = (cgv*contrast * saturation) >> 32; - oy -= 256*brightness; - - //scale coefficients by cy - crv = ((crv << 16) + 0x8000) / cy; - cbu = ((cbu << 16) + 0x8000) / cy; - cgu = ((cgu << 16) + 0x8000) / cy; - cgv = ((cgv << 16) + 0x8000) / cy; - - av_free(c->yuvTable); - - switch (bpp) { - case 1: - c->yuvTable = av_malloc(1024); - y_table = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024-110; i++) { - y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7; - yb += cy; - } - fill_table(c->table_gU, 1, cgu, y_table + yoffs); - fill_gv_table(c->table_gV, 1, cgv); - break; - case 4: - case 4|128: - rbase = isRgb ? 3 : 0; - gbase = 1; - bbase = isRgb ? 0 : 3; - c->yuvTable = av_malloc(1024*3); - y_table = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024-110; i++) { - int yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table[i+110 ] = (yval >> 7) << rbase; - y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase; - y_table[i+110+2048] = (yval >> 7) << bbase; - yb += cy; - } - fill_table(c->table_rV, 1, crv, y_table + yoffs); - fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); - fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); - fill_gv_table(c->table_gV, 1, cgv); - break; - case 8: - rbase = isRgb ? 5 : 0; - gbase = isRgb ? 2 : 3; - bbase = isRgb ? 0 : 6; - c->yuvTable = av_malloc(1024*3); - y_table = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024-38; i++) { - int yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table[i+16 ] = ((yval + 18) / 36) << rbase; - y_table[i+16+1024] = ((yval + 18) / 36) << gbase; - y_table[i+37+2048] = ((yval + 43) / 85) << bbase; - yb += cy; - } - fill_table(c->table_rV, 1, crv, y_table + yoffs); - fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); - fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); - fill_gv_table(c->table_gV, 1, cgv); - break; - case 15: - case 16: - rbase = isRgb ? bpp - 5 : 0; - gbase = 5; - bbase = isRgb ? 0 : (bpp - 5); - c->yuvTable = av_malloc(1024*3*2); - y_table16 = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024; i++) { - uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table16[i ] = (yval >> 3) << rbase; - y_table16[i+1024] = (yval >> (18 - bpp)) << gbase; - y_table16[i+2048] = (yval >> 3) << bbase; - yb += cy; - } - fill_table(c->table_rV, 2, crv, y_table16 + yoffs); - fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); - fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); - fill_gv_table(c->table_gV, 2, cgv); - break; - case 24: - c->yuvTable = av_malloc(1024); - y_table = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024; i++) { - y_table[i] = av_clip_uint8((yb + 0x8000) >> 16); - yb += cy; - } - fill_table(c->table_rV, 1, crv, y_table + yoffs); - fill_table(c->table_gU, 1, cgu, y_table + yoffs); - fill_table(c->table_bU, 1, cbu, y_table + yoffs); - fill_gv_table(c->table_gV, 1, cgv); - break; - case 32: - base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0; - rbase = base + (isRgb ? 16 : 0); - gbase = base + 8; - bbase = base + (isRgb ? 0 : 16); - c->yuvTable = av_malloc(1024*3*4); - y_table32 = c->yuvTable; - yb = -(384<<16) - oy; - for (i = 0; i < 1024; i++) { - uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); - y_table32[i ] = yval << rbase; - y_table32[i+1024] = yval << gbase; - y_table32[i+2048] = yval << bbase; - yb += cy; - } - fill_table(c->table_rV, 4, crv, y_table32 + yoffs); - fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024); - fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048); - fill_gv_table(c->table_gV, 4, cgv); - break; - default: - c->yuvTable = NULL; - av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); - return -1; - } - return 0; -} diff --git a/libswscale/yuv2rgb_altivec.c b/libswscale/yuv2rgb_altivec.c index a4cdcf898f..784c197d70 100644 --- a/libswscale/yuv2rgb_altivec.c +++ b/libswscale/yuv2rgb_altivec.c @@ -5,18 +5,18 @@ * * This file is part of FFmpeg. * - * FFmpeg is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with FFmpeg; if not, write to the Free Software + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index d0f6ac07f4..75d0f4d768 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -150,6 +150,7 @@ static int deint; static int pullup; static float denoise; static float sharpen; +static int top_field_first; static VdpDecoder decoder; static int decoder_max_refs; @@ -200,24 +201,35 @@ static void video_to_output_surface(void) { VdpTime dummy; VdpStatus vdp_st; - VdpOutputSurface output_surface = output_surfaces[surface_num]; + int i; if (vid_surface_num < 0) return; - vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, - output_surface, - &dummy); - CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") - - // we would need to provide past and future frames to allow deinterlacing, - // which is not really possible currently. Deinterlacing is supposed to fall - // back to bob deinterlacing, but that seems not to work either. - vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, - VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME, - 0, NULL, surface_render[vid_surface_num].surface, 0, NULL, &src_rect_vid, - output_surface, - NULL, &out_rect_vid, 0, NULL); - CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") + // we would need to provide 2 past and 1 future frames to allow advanced + // deinterlacing, which is not really possible currently. + for (i = 0; i <= !!deint; i++) { + int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME; + VdpOutputSurface output_surface; + if (i) + flip_page(); + if (deint) + field = top_field_first == i ? + VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD: + VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD; + output_surface = output_surfaces[surface_num]; + vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue, + output_surface, + &dummy); + CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle") + + vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0, + field, 0, NULL, + surface_render[vid_surface_num].surface, + 0, NULL, &src_rect_vid, + output_surface, + NULL, &out_rect_vid, 0, NULL); + CHECK_ST_WARNING("Error when calling vdp_video_mixer_render") + } } static void resize(void) @@ -381,9 +393,9 @@ static int create_vdp_mixer(VdpChromaType vdp_chroma_type) { &vid_height, &vdp_chroma_type }; - if (deint == 1) - features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; if (deint == 2) + features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL; + if (deint == 3) features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL; if (pullup) features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE; @@ -817,6 +829,7 @@ static uint32_t draw_image(mp_image_t *mpi) mpi->stride); // pitch CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr") } + top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST); video_to_output_surface(); return VO_TRUE; @@ -932,8 +945,9 @@ static const char help_msg[] = "\nOptions:\n" " deint\n" " 0: no deinterlacing\n" - " 1: temporal deinterlacing (not yet working)\n" - " 2: temporal-spatial deinterlacing (not yet working)\n" + " 1: bob deinterlacing (current fallback)\n" + " 2: temporal deinterlacing (not yet working)\n" + " 3: temporal-spatial deinterlacing (not yet working)\n" " pullup\n" " Try to apply inverse-telecine (needs deinterlacing, not working)\n" " denoise\n" diff --git a/libvo/w32_common.c b/libvo/w32_common.c index 076544dbab..a23ec8ea42 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -112,11 +112,12 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l if (vo_keepaspect && !vo_fs) { WINDOWPOS *wpos = lParam; int xborder, yborder; - RECT r2; - GetClientRect(vo_window, &r); - GetWindowRect(vo_window, &r2); - xborder = (r2.right - r2.left) - (r.right - r.left); - yborder = (r2.bottom - r2.top) - (r.bottom - r.top); + r.left = r.top = 0; + r.right = wpos->cx; + r.bottom = wpos->cy; + AdjustWindowRect(&r, GetWindowLong(vo_window, GWL_STYLE), 0); + xborder = (r.right - r.left) - wpos->cx; + yborder = (r.bottom - r.top) - wpos->cy; wpos->cx -= xborder; wpos->cy -= yborder; aspect_fit(global_vo, &wpos->cx, &wpos->cy, wpos->cx, wpos->cy); wpos->cx += xborder; wpos->cy += yborder; diff --git a/version.sh b/version.sh index 2eb66292d2..eb302c9134 100755 --- a/version.sh +++ b/version.sh @@ -2,13 +2,16 @@ test "$1" && extra="-$1" -svn_revision=`LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2` -test $svn_revision || svn_revision=`grep revision .svn/entries 2>/dev/null | cut -d '"' -f2` -test $svn_revision || svn_revision=`sed -n -e '/^dir$/{n;p;q;}' .svn/entries 2>/dev/null` +# Extract revision number from file used by daily tarball snapshots +# or from the places different Subversion versions have it. +svn_revision=$(cat snapshot_version 2> /dev/null) +test $svn_revision || svn_revision=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2) +test $svn_revision || svn_revision=$(grep revision .svn/entries 2>/dev/null | cut -d '"' -f2) +test $svn_revision || svn_revision=$(sed -n -e '/^dir$/{n;p;q;}' .svn/entries 2>/dev/null) test $svn_revision || svn_revision=UNKNOWN NEW_REVISION="#define VERSION \"SVN-r${svn_revision}${extra}\"" -OLD_REVISION=`cat version.h 2> /dev/null` +OLD_REVISION=$(cat version.h 2> /dev/null) TITLE='#define MP_TITLE "%s "VERSION" (C) 2000-2009 MPlayer Team\n"' # Update version.h only on revision changes to avoid spurious rebuilds |