Ticket #979: testcase.c

File testcase.c, 5.5 KB (added by natt, 4 years ago)
Line 
1/*
2I ran these two tests:
3testcase | ffmpeg -v 9 -loglevel 99 -f rawvideo -video_size 256x256 -pix_fmt bgr24 -i -                      -sws_flags lanczos -f rawvideo -pix_fmt yuv420p out1.raw
4testcase | ffmpeg -v 9 -loglevel 99 -f rawvideo -video_size 256x256 -pix_fmt bgr24 -i - -filter format=rgb24 -sws_flags lanczos -f rawvideo -pix_fmt yuv420p out2.raw
5
6Full console output is below.  testcase the executable built from this source file.
7
8
9
10
11
12
13testcase | ffmpeg -v 9 -loglevel 99 -f rawvideo -video_size 256x256 -pix_fmt bgr24 -i -                      -sws_flags lanczos -f rawvideo -pix_fmt yuv420p out1.raw
14
15ffmpeg version N-37541-g670229e Copyright (c) 2000-2012 the FFmpeg developers
16  built on Feb  3 2012 20:07:47 with gcc 4.6.2
17  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
18ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
19ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
20able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
21-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
22c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
23libxvid --enable-zlib
24  libavutil      51. 37.100 / 51. 37.100
25  libavcodec     54.  0.102 / 54.  0.102
26  libavformat    54.  0.100 / 54.  0.100
27  libavdevice    53.  4.100 / 53.  4.100
28  libavfilter     2. 61.100 /  2. 61.100
29  libswscale      2.  1.100 /  2.  1.100
30  libswresample   0.  6.100 /  0.  6.100
31  libpostproc    52.  0.100 / 52.  0.100
32[rawvideo @ 003A98E0] All info found
33[rawvideo @ 003A98E0] Estimating duration from bitrate, this may be inaccurate
34Input #0, rawvideo, from 'pipe:':
35  Duration: N/A, start: 0.000000, bitrate: N/A
36    Stream #0:0, 1, 1/25: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 256x256
37, 1/25, 25 tbr, 25 tbn, 25 tbc
38[buffer @ 003AFE80] w:256 h:256 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
39[buffersink @ 003AFF60] auto-inserting filter 'auto-inserted scale 0' between th
40e filter 'src' and the filter 'out'
41[scale @ 038540E0] w:256 h:256 fmt:bgr24 -> w:256 h:256 fmt:yuv420p flags:0x200
42Output #0, rawvideo, to 'out1.raw':
43  Metadata:
44    encoder         : Lavf54.0.100
45    Stream #0:0, 0, 1/90000: Video: rawvideo (I420 / 0x30323449), yuv420p, 256x2
4656, 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
47Stream mapping:
48  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
49frame=    1 fps=  0 q=0.0 Lsize=      96kB time=00:00:00.04 bitrate=19660.8kbits
50/s
51video:96kB audio:0kB global headers:0kB muxing overhead 0.000000%
52
53testcase | ffmpeg -v 9 -loglevel 99 -f rawvideo -video_size 256x256 -pix_fmt bgr24 -i - -filter format=rgb24 -sws_flags lanczos -f rawvideo -pix_fmt yuv420p out2.raw
54
55ffmpeg version N-37541-g670229e Copyright (c) 2000-2012 the FFmpeg developers
56  built on Feb  3 2012 20:07:47 with gcc 4.6.2
57  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
58ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
59ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
60able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
61-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
62c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
63libxvid --enable-zlib
64  libavutil      51. 37.100 / 51. 37.100
65  libavcodec     54.  0.102 / 54.  0.102
66  libavformat    54.  0.100 / 54.  0.100
67  libavdevice    53.  4.100 / 53.  4.100
68  libavfilter     2. 61.100 /  2. 61.100
69  libswscale      2.  1.100 /  2.  1.100
70  libswresample   0.  6.100 /  0.  6.100
71  libpostproc    52.  0.100 / 52.  0.100
72[rawvideo @ 00369980] All info found
73[rawvideo @ 00369980] Estimating duration from bitrate, this may be inaccurate
74Input #0, rawvideo, from 'pipe:':
75  Duration: N/A, start: 0.000000, bitrate: N/A
76    Stream #0:0, 1, 1/25: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 256x256
77, 1/25, 25 tbr, 25 tbn, 25 tbc
78[buffer @ 00369E80] w:256 h:256 pixfmt:bgr24 tb:1/1000000 sar:0/1 sws_param:
79[buffersink @ 03973700] auto-inserting filter 'auto-inserted scale 0' between th
80e filter 'Parsed_format_0' and the filter 'out'
81[format @ 03973960] auto-inserting filter 'auto-inserted scale 1' between the fi
82lter 'src' and the filter 'Parsed_format_0'
83[scale @ 03974880] w:256 h:256 fmt:bgr24 -> w:256 h:256 fmt:rgb24 flags:0x200
84[scale @ 03973900] w:256 h:256 fmt:rgb24 -> w:256 h:256 fmt:yuv420p flags:0x200
85Output #0, rawvideo, to 'out2.raw':
86  Metadata:
87    encoder         : Lavf54.0.100
88    Stream #0:0, 0, 1/90000: Video: rawvideo (I420 / 0x30323449), yuv420p, 256x2
8956, 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
90Stream mapping:
91  Stream #0:0 -> #0:0 (rawvideo -> rawvideo)
92frame=    1 fps=  0 q=0.0 Lsize=      96kB time=00:00:00.04 bitrate=19660.8kbits
93/s
94video:96kB audio:0kB global headers:0kB muxing overhead 0.000000% 
95
96*/
97
98
99#include <stdio.h>
100
101#ifdef WIN32
102#include <fcntl.h>
103#endif
104
105int main (void)
106{
107  int i, j;
108  #ifdef WIN32
109  setmode (fileno (stdout), O_BINARY);
110  setmode (fileno (stdin), O_BINARY);
111  #endif
112
113 
114  for (j = 0; j < 256; j++)
115  {
116    for (i = 0; i < 256; i++)
117    {
118      // format is bgr24
119      // b: 0 to 240 step 16 in vertical 16 pixel stripes
120      putchar (j / 16 * 16);
121      // g: 0 to 240 step 16 in horizontal 16 pixel stripes
122      putchar (i / 16 * 16);
123      // r: constant 128
124      putchar (128);
125    }
126  }
127  return 0;
128}
129