summaryrefslogtreecommitdiff
path: root/tests/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-30 01:39:24 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-30 01:40:54 +0200
commitb0387edd5e766b1032f946d6cdb35b765bb45435 (patch)
treedd3ca8577a8d3b05efee8b1214a80f845ddeb47f /tests/utils.c
parent8619362ff1de6605ffe6da8a42bdfe4fb7be75c1 (diff)
parentf919cc7df6ab844bc12f89fe7bef4fb915a47725 (diff)
Merge commit 'f919cc7df6ab844bc12f89fe7bef4fb915a47725'
* commit 'f919cc7df6ab844bc12f89fe7bef4fb915a47725': fate: fix acodec/vsynth tests for make 3.81 pcm_mpeg: fix number of consumed bytes to include the header. avfilter: include required header file avfilter.h in video.h x86: Avoid movs on BUTTERFLYPS when in AVX mode x86: use new schema for ASM macros fate: convert codec-regression.sh to makefile rules fate: allow tests to specify unit size for psnr comparison fate: teach videogen/rotozoom to output a single raw video stream http: Add support for reusing the http socket for subsequent requests http: Add support for using persistent connections Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tests/utils.c')
-rw-r--r--tests/utils.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/tests/utils.c b/tests/utils.c
index 3fef048476..e8ef06f7ef 100644
--- a/tests/utils.c
+++ b/tests/utils.c
@@ -117,20 +117,37 @@ static void pgmyuv_save(const char *filename, int w, int h,
rgb24_to_yuv420p(lum_tab, cb_tab, cr_tab, rgb_tab, w, h);
- f = fopen(filename, "wb");
- fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
+ if (filename) {
+ f = fopen(filename, "wb");
+ fprintf(f, "P5\n%d %d\n%d\n", w, h * 3 / 2, 255);
+ } else {
+ f = stdout;
+ }
+
err_if(fwrite(lum_tab, 1, w * h, f) != w * h);
h2 = h / 2;
w2 = w / 2;
cb = cb_tab;
cr = cr_tab;
- for (i = 0; i < h2; i++) {
- err_if(fwrite(cb, 1, w2, f) != w2);
- err_if(fwrite(cr, 1, w2, f) != w2);
- cb += w2;
- cr += w2;
+
+ if (filename) {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cb += w2;
+ cr += w2;
+ }
+ fclose(f);
+ } else {
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cb, 1, w2, f) != w2);
+ cb += w2;
+ }
+ for (i = 0; i < h2; i++) {
+ err_if(fwrite(cr, 1, w2, f) != w2);
+ cr += w2;
+ }
}
- fclose(f);
free(lum_tab);
free(cb_tab);