[FFmpeg-devel] [PATCH] swscale-example: Remove hack to end loop by setting variables to break.
Michael Niedermayer
michaelni
Thu Aug 13 03:10:59 CEST 2009
On Wed, Aug 12, 2009 at 09:43:09PM -0300, Ramiro Polla wrote:
> $subj,
>
> This is part of a series of patches to make swscale-example actually
> serve as an example. I intend to also do add a bunch of comments, do a
> bunch of cosmetics, and make the code more readable.
>
> Ramiro Polla
> swscale-example.c | 18 +++++-------------
> 1 file changed, 5 insertions(+), 13 deletions(-)
> 25ea61201ddc473c339d7cd62724b78580bdc529 0006-swscale-example-Remove-hack-to-end-loop-by-setting.patch
> From 9490df4c8ed893d52be36dd001664ec3bb524aa3 Mon Sep 17 00:00:00 2001
> From: Ramiro Polla <ramiro.polla at gmail.com>
> Date: Wed, 12 Aug 2009 20:39:57 -0300
> Subject: [PATCH] swscale-example: Remove hack to end loop by setting variables to break.
>
> ---
> swscale-example.c | 18 +++++-------------
> 1 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/swscale-example.c b/swscale-example.c
> index f496d0f..f48c8ba 100644
> --- a/swscale-example.c
> +++ b/swscale-example.c
> @@ -185,6 +185,8 @@ static void selfTest(uint8_t *src[4], int stride[4], int w, int h){
>
> for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
> for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
> + int res = 0;
> +
> printf("%s -> %s\n",
> sws_format_name(srcFormat),
> sws_format_name(dstFormat));
> @@ -192,21 +194,11 @@ static void selfTest(uint8_t *src[4], int stride[4], int w, int h){
>
> srcW= w;
> srcH= h;
> - for (dstW=w - w/3; dstW<= 4*w/3; dstW+= w/3){
> - for (dstH=h - h/3; dstH<= 4*h/3; dstH+= h/3){
> - for (flags=1; flags<33; flags*=2) {
> - int res;
> -
> + for (dstW=w - w/3; !res && dstW<= 4*w/3; dstW+= w/3)
> + for (dstH=h - h/3; !res && dstH<= 4*h/3; dstH+= h/3)
> + for (flags=1; !res && flags<33; flags*=2)
> res = doTest(src, stride, w, h, srcFormat, dstFormat,
> srcW, srcH, dstW, dstH, flags);
> - if (res < 0) {
> - dstW = 4 * w / 3;
> - dstH = 4 * h / 3;
> - flags = 33;
> - }
> - }
> - }
> - }
> }
> }
> }
ok as its alot better than now but i think ideally a
if(res<0)
print error message
return -1 / goto end
would be better
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090813/291203fb/attachment.pgp>
More information about the ffmpeg-devel
mailing list