11SCENARIO(
"streamWriter Buffer Sizing",
"[streamWriter]" )
13 GIVEN(
"A default constructed streamWriter" )
15 WHEN(
"default configurations" )
17 size_t maxCircBuffLength = 1024;
18 double maxCircBuffSize = 2048.0;
19 size_t maxWriteChunkLength = 512;
21 size_t circBuffLength;
23 size_t writeChunkLength;
25 uint32_t width = 1024;
26 uint32_t height = 1024;
39 REQUIRE( circBuffLength == 1024 );
40 REQUIRE( circBuffSize == 2048 );
41 REQUIRE( writeChunkLength == 512 );
44 WHEN(
"larger frame size using all of max size" )
46 size_t maxCircBuffLength = 1024;
47 double maxCircBuffSize = 2048.0;
48 size_t maxWriteChunkLength = 512;
50 size_t circBuffLength;
52 size_t writeChunkLength;
54 uint32_t width = 2048;
55 uint32_t height = 2048;
68 REQUIRE( circBuffLength == 256 );
69 REQUIRE( circBuffSize == 2048 );
70 REQUIRE( writeChunkLength == 128 );
73 WHEN(
"largest frame size possible using all of max size" )
75 size_t maxCircBuffLength = 1024;
76 double maxCircBuffSize = 1024.0;
77 size_t maxWriteChunkLength = 512;
79 size_t circBuffLength;
81 size_t writeChunkLength;
83 uint32_t width = 16384;
84 uint32_t height = 16384;
98 REQUIRE( circBuffSize == 1024 );
99 REQUIRE( writeChunkLength == 1 );
102 WHEN(
"Exceeding largest frame size possible" )
104 size_t maxCircBuffLength = 1024;
105 double maxCircBuffSize = 1024.0;
106 size_t maxWriteChunkLength = 512;
108 size_t circBuffLength;
110 size_t writeChunkLength;
112 uint32_t width = 16385;
113 uint32_t height = 16385;
126 REQUIRE( circBuffLength == 1 );
128 REQUIRE( writeChunkLength == 1 );
131 WHEN(
"Exceeding largest frame size possible by a lot" )
133 size_t maxCircBuffLength = 1024;
134 double maxCircBuffSize = 1024.0;
135 size_t maxWriteChunkLength = 512;
137 size_t circBuffLength;
139 size_t writeChunkLength;
141 uint32_t width = 56385;
142 uint32_t height = 56385;
155 REQUIRE( circBuffLength == 0 );
157 REQUIRE( writeChunkLength == 0 );
160 WHEN(
"LOWFS-like setup, 32x32 frames" )
162 size_t maxCircBuffLength = 524288;
163 double maxCircBuffSize = 1024.0;
164 size_t maxWriteChunkLength = 16384;
166 size_t circBuffLength;
168 size_t writeChunkLength;
171 uint32_t height = 32;
184 REQUIRE( circBuffLength == 524288 );
186 REQUIRE( writeChunkLength == 16384 );
187 REQUIRE( ( circBuffLength % writeChunkLength ) == 0 );
190 WHEN(
"LOWFS-like setup, 512x512 frames" )
192 size_t maxCircBuffLength = 524288;
193 double maxCircBuffSize = 1024.0;
194 size_t maxWriteChunkLength = 16384;
196 size_t circBuffLength;
198 size_t writeChunkLength;
200 uint32_t width = 512;
201 uint32_t height = 512;
214 REQUIRE( circBuffLength == 2048 );
216 REQUIRE( writeChunkLength == 64 );
217 REQUIRE( ( circBuffLength % writeChunkLength ) == 0 );
220 WHEN(
"LOWFS-like setup, 3200x3200 frames" )
222 size_t maxCircBuffLength = 524288;
223 double maxCircBuffSize = 1024.0;
224 size_t maxWriteChunkLength = 16384;
226 size_t circBuffLength;
228 size_t writeChunkLength;
230 uint32_t width = 3200;
231 uint32_t height = 3200;
244 REQUIRE( circBuffLength == 52 );
246 REQUIRE( writeChunkLength == 1 );
247 REQUIRE( ( circBuffLength % writeChunkLength ) == 0 );
static void getCircBuffLengths(size_t &circBuffLength, double &circBuffSize, size_t &writeChunkLength, size_t maxCircBuffLength, double maxCircBuffSize, size_t maxWriteChunkLength, uint32_t width, uint32_t height, size_t typeSize)