[Ffmpeg-devel] [PATCH] watermark.c optimizations for single-frame input (previous patch included)

Mihail Stoyanov screamer
Fri Oct 20 15:41:41 CEST 2006

This patch optimizes watermark.c in 2 ways
1. Checks if the current pixel RGB (of the input image) is equal to the 
threshold before doing any other calculations, thus skipping useless 

2. When using single-frame watermark input...
Checks the starting & ending coordinates (actually rectangle) of the actual 
watermark (inside the watermark input) using threshold comparison.
In that way only the area which contains the actual watermark is applied 
over the movie source reducing the itterations - "for (y...)" & "for (x...)" 
and greatly improving the covert times.
It also have checks if the watermark source is multi-frame and disables the 

NOTE: These optimizations are applied ONLY if you are using mode 0 (the 

Original watermark.c
-> Convert time: 00:31

Patched watermark.c when using multi-frame watermark source (a.k.a animated 
images or movies)
-> Convert time: 00:26

Patched watermark.c when using single-frame watermark source (a.k.a. image)
-> Convert time: 00:18

Without watermarking
-> Convert time: 00:12

P.S. Marcus this one is attached :) 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: watermark_mod2.patch
Type: application/octet-stream
Size: 5689 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20061020/4a2ce02b/attachment.obj>

More information about the ffmpeg-devel mailing list