diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-03-04 03:31:10 +0300 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-03-04 03:31:10 +0300 |
commit | 3fec44c640ea0c8fd1944e9a41da50a3d7251274 (patch) | |
tree | ef89fcf05fe134cfeb020d1dc0bd7341852247fa /libswscale/swscale-test.c | |
parent | ce7c7179001d955e6cd639094bfc8b13e563d9bd (diff) |
Make swscale-test take in input the name of the input and the output
format.
Make swscale-test only perform the test from the input to the output
format rather than perform all.
Also implement swscale-test-all.sh, for performing all the tests.
Improve flexibility of the swscale-test tool, this way is simpler to
perform only a subset of tests.
Originally committed as revision 30825 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
Diffstat (limited to 'libswscale/swscale-test.c')
-rw-r--r-- | libswscale/swscale-test.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c index 887973a40e..2ece78a254 100644 --- a/libswscale/swscale-test.c +++ b/libswscale/swscale-test.c @@ -25,9 +25,12 @@ #include <stdarg.h> #undef HAVE_AV_CONFIG_H + +#include "libavutil/log.h" #include "libavutil/mem.h" #include "libavutil/avutil.h" #include "libavutil/lfg.h" +#include "libavutil/pixdesc.h" #include "swscale.h" /* HACK Duplicated from swscale_internal.h. @@ -186,27 +189,16 @@ end: return res; } -static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) +static void selfTest(uint8_t *ref[4], int refStride[4], enum PixelFormat srcFormat, enum PixelFormat dstFormat, int w, int h) { const int flags[] = { SWS_FAST_BILINEAR, SWS_BILINEAR, SWS_BICUBIC, SWS_X , SWS_POINT , SWS_AREA, 0 }; const int srcW = w; const int srcH = h; + int i, j, k, res = 0; const int dstW[] = { srcW - srcW/3, srcW, srcW + srcW/3, 0 }; const int dstH[] = { srcH - srcH/3, srcH, srcH + srcH/3, 0 }; - enum PixelFormat srcFormat, dstFormat; - - for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) { - if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat)) - continue; - - for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) { - int i, j, k; - int res = 0; - - if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat)) - continue; printf("%s -> %s\n", sws_format_name(srcFormat), @@ -217,9 +209,7 @@ static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h) for (j = 0; dstH[j] && !res; j++) for (k = 0; flags[k] && !res; k++) res = doTest(ref, refStride, w, h, srcFormat, dstFormat, - srcW, srcH, dstW[i], dstH[j], flags[k]); - } - } + srcW, srcH, dstW[i], dstH[j], flags[k]|SWS_PRINT_INFO); } #define W 96 @@ -235,12 +225,28 @@ int main(int argc, char **argv) int stride[4]={W, W, W, W}; int x, y; struct SwsContext *sws; + enum PixelFormat srcFmt, dstFmt; AVLFG rand; + av_log_set_level(AV_LOG_INFO); + + if (argc < 3) { + fprintf(stderr, "Usage: swscale-test SRC_PIX_FMT DST_PIX_FMT\n"); + return -1; + } + if ((srcFmt = av_get_pix_fmt(argv[1])) == PIX_FMT_NONE) { + fprintf(stderr, "Unknown pixel input format name: '%s'\n", argv[1]); + return -1; + } + if ((dstFmt = av_get_pix_fmt(argv[2])) == PIX_FMT_NONE) { + fprintf(stderr, "Unknown pixel output format name: '%s'\n", argv[2]); + return -1; + } if (!rgb_data || !data) return -1; - sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL); + sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, + SWS_BILINEAR|SWS_PRINT_INFO, NULL, NULL, NULL); av_lfg_init(&rand, 1); @@ -253,7 +259,7 @@ int main(int argc, char **argv) sws_freeContext(sws); av_free(rgb_data); - selfTest(src, stride, W, H); + selfTest(src, stride, srcFmt, dstFmt, W, H); av_free(data); return 0; |