2 * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef I965_STREAMABLE_H
26 #define I965_STREAMABLE_H
36 template <typename T, const size_t S> inline std::ostream&
37 operator<<(std::ostream& os, const std::array<T, S>& a)
40 for (const auto& s : a) {
48 template <const size_t S> inline std::ostream&
49 operator<<(std::ostream& os, const std::array<uint8_t, S>& a)
51 os << "{" << std::hex;
52 for (const auto& s : a) {
55 os << "0x" << std::setfill('0') << std::setw(2) << unsigned(s);
57 return os << std::dec << "}";
60 template <typename T> inline std::ostream&
61 operator<<(std::ostream& os, const std::valarray<T>& a)
64 for (const auto& s : a) {
72 template <> inline std::ostream&
73 operator<<(std::ostream& os, const std::valarray<uint8_t>& a)
75 os << "{" << std::hex;
76 for (const auto& s : a) {
79 os << "0x" << std::setfill('0') << std::setw(2) << unsigned(s);
81 return os << std::dec << "}";
86 const std::string toString(const T& t)
88 std::ostringstream os;
94 operator<<(std::ostream& os, const VAEncPictureParameterBufferJPEG& b)
96 os << "VAEncPictureParameterBufferJPEG (" << &b << ")" << std::endl
97 << " .reconstructed_picture = " << b.reconstructed_picture
100 << " .picture_width = " << b.picture_width
103 << " .picture_height = " << b.picture_height
106 << " .coded_buf = " << b.coded_buf
109 << " .pic_flags.value = "
110 << std::hex << std::setw(8) << std::setfill('0') << b.pic_flags.value
114 << " ...profile = " << b.pic_flags.bits.profile
115 << " (0 - Baseline, 1 - Extended, 2 - Lossless, 3 - Hierarchical)"
118 << " ...progressive = " << b.pic_flags.bits.progressive
119 << " (0 - sequential, 1 - extended, 2 - progressive)"
122 << " ...huffman = " << b.pic_flags.bits.huffman
123 << " (0 - arithmetic, 1 - huffman)"
126 << " ...interleaved = " << b.pic_flags.bits.interleaved
127 << " (0 - non interleaved, 1 - interleaved)"
130 << " ...differential = " << b.pic_flags.bits.differential
131 << " (0 - non differential, 1 - differential)"
134 << " .sample_bit_depth = " << (unsigned)b.sample_bit_depth
137 << " .num_scan = " << (unsigned)b.num_scan
140 << " .num_components = " << (unsigned)b.num_components
143 << " .component_id = "
144 << (unsigned)b.component_id[0] << ","
145 << (unsigned)b.component_id[1] << ","
146 << (unsigned)b.component_id[2] << ","
147 << (unsigned)b.component_id[3] << ","
150 << " .quantiser_table_selector = "
151 << (unsigned)b.quantiser_table_selector[0] << ","
152 << (unsigned)b.quantiser_table_selector[1] << ","
153 << (unsigned)b.quantiser_table_selector[2] << ","
154 << (unsigned)b.quantiser_table_selector[3] << ","
157 << " .quality = " << (unsigned)b.quality
164 operator<<(std::ostream& os, const VAEncPictureParameterBufferJPEG* b)
171 operator<<(std::ostream& os, const VAQMatrixBufferJPEG& b)
173 os << "VAQMatrixBufferJPEG (" << &b << ")" << std::endl;
175 os << " .load_lum_quantiser_matrix = " << b.load_lum_quantiser_matrix
179 if (b.load_lum_quantiser_matrix)
181 os << " .lum_quantiser_matrix = ";
182 for (size_t i(0); i < sizeof(b.lum_quantiser_matrix); ++i) {
183 os << std::hex << std::setw(2) << std::setfill('0')
184 << (unsigned)b.lum_quantiser_matrix[i] << ",";
185 if (((i+1) % 12) == 0)
186 os << std::endl << " ";
188 os << std::dec << std::endl;
191 os << " .load_chroma_quantiser_matrix = " << b.load_chroma_quantiser_matrix
195 if (b.load_lum_quantiser_matrix)
197 os << " .chroma_quantiser_matrix = ";
198 for (size_t i(0); i < sizeof(b.chroma_quantiser_matrix); ++i) {
199 os << std::hex << std::setw(2) << std::setfill('0')
200 << (unsigned)b.chroma_quantiser_matrix[i] << ",";
201 if (((i+1) % 12) == 0)
202 os << std::endl << " ";
204 os << std::dec << std::endl;
211 operator<<(std::ostream& os, const VAQMatrixBufferJPEG* b)
218 operator<<(std::ostream& os, const VAHuffmanTableBufferJPEGBaseline& b)
220 os << "VAHuffmanTableBufferJPEGBaseline (" << &b << ")" << std::endl;
222 os << " .load_huffman_table = "
223 << (unsigned)b.load_huffman_table[0] << ","
224 << (unsigned)b.load_huffman_table[1] << ","
228 for (size_t i(0); i < 2; ++i) {
230 os << " .huffman_table[" << i << "].num_dc_codes = ";
231 for (size_t j(0); j < sizeof(b.huffman_table[i].num_dc_codes); ++j) {
232 if (j and (j % 12) == 0)
233 os << std::endl << " ";
234 os << std::hex << std::setfill('0') << std::setw(2)
235 << (unsigned)b.huffman_table[i].num_dc_codes[j] << ","
238 sum += b.huffman_table[i].num_dc_codes[j];
240 os << " (sum = " << sum << ")" << std::endl;
242 os << " .huffman_table[" << i << "].dc_values = ";
243 for (size_t j(0); j < sizeof(b.huffman_table[i].dc_values); ++j) {
244 if (j and (j % 12) == 0)
245 os << std::endl << " ";
246 os << std::hex << std::setfill('0') << std::setw(2)
247 << (unsigned)b.huffman_table[i].dc_values[j] << ","
254 os << " .huffman_table[" << i << "].num_ac_codes = ";
255 for (size_t j(0); j < sizeof(b.huffman_table[i].num_ac_codes); ++j) {
256 if (j and (j % 12) == 0)
257 os << std::endl << " ";
258 os << std::hex << std::setfill('0') << std::setw(2)
259 << (unsigned)b.huffman_table[i].num_ac_codes[j] << ","
262 sum += b.huffman_table[i].num_ac_codes[j];
264 os << " (sum = " << sum << ")" << std::endl;
266 os << " .huffman_table[" << i << "].ac_values = ";
267 for (size_t j(0); j < sizeof(b.huffman_table[i].ac_values); ++j) {
268 if (j and (j % 12) == 0)
269 os << std::endl << " ";
270 os << std::hex << std::setfill('0') << std::setw(2)
271 << (unsigned)b.huffman_table[i].ac_values[j] << ","
281 operator<<(std::ostream& os, const VAHuffmanTableBufferJPEGBaseline* b)
288 operator<<(std::ostream& os, const VAEncSliceParameterBufferJPEG& b)
290 os << "VAEncSliceParameterBufferJPEG (" << &b << ")" << std::endl
291 << " .restart_interval = " << b.restart_interval
294 << " .num_components = " << b.num_components
298 for (size_t i(0); i < 4; ++i) {
299 os << " .components[" << i << "]" << std::endl
300 << " .component_selector = "
301 << (unsigned)b.components[i].component_selector
304 << " .dc_table_selector = "
305 << (unsigned)b.components[i].dc_table_selector
308 << " .ac_table_selector = "
309 << (unsigned)b.components[i].ac_table_selector
318 operator<<(std::ostream& os, const VAEncSliceParameterBufferJPEG* b)
325 operator<<(std::ostream& os, const VAEncPackedHeaderParameterBuffer& b)
327 os << "VAEncPackedHeaderParameterBuffer (" << &b << ")" << std::endl
328 << " .type = " << b.type
330 << " .bit_length = " << b.bit_length
332 << " .has_emulation_bytes = " << (unsigned)b.has_emulation_bytes
340 operator<<(std::ostream& os, const VAEncPackedHeaderParameterBuffer* b)
347 operator<<(std::ostream& os, const VAImage& image)
349 os << "VAImage (" << &image << ")"
350 << std::dec << std::endl
351 << " id : " << image.image_id
354 << std::string(reinterpret_cast<const char*>(&image.format.fourcc), 4)
356 << " size : " << image.width << "x" << image.height
358 << " planes : " << image.num_planes
362 << image.offsets[0] << ","
363 << image.offsets[1] << ","
369 << image.pitches[0] << ","
370 << image.pitches[1] << ","
374 << " bpp : " << image.format.bits_per_pixel
376 << " depth : " << image.format.depth
378 << " byteorder: " << image.format.byte_order
382 << image.format.red_mask << ","
383 << image.format.green_mask << ","
384 << image.format.blue_mask << ","
385 << image.format.alpha_mask
388 << " buffer id: " << image.buf
390 << " data size: " << image.data_size
396 operator<<(std::ostream& os, const VAProfile& profile)
400 return os << "VAProfileNone";
401 case VAProfileMPEG2Simple:
402 return os << "VAProfileMPEG2Simple";
403 case VAProfileMPEG2Main:
404 return os << "VAProfileMPEG2Main";
405 case VAProfileMPEG4Simple:
406 return os << "VAProfileMPEG4Simple";
407 case VAProfileMPEG4AdvancedSimple:
408 return os << "VAProfileMPEG4AdvancedSimple";
409 case VAProfileMPEG4Main:
410 return os << "VAProfileMPEG4Main";
411 case VAProfileVC1Simple:
412 return os << "VAProfileVC1Simple";
413 case VAProfileVC1Main:
414 return os << "VAProfileVC1Main";
415 case VAProfileVC1Advanced:
416 return os << "VAProfileVC1Advanced";
417 case VAProfileH263Baseline:
418 return os << "VAProfileH263Baseline";
419 case VAProfileJPEGBaseline:
420 return os << "VAProfileJPEGBaseline";
421 case VAProfileVP8Version0_3:
422 return os << "VAProfileVP8Version0_3";
423 case VAProfileHEVCMain:
424 return os << "VAProfileHEVCMain";
425 case VAProfileHEVCMain10:
426 return os << "VAProfileHEVCMain10";
427 case VAProfileVP9Profile0:
428 return os << "VAProfileVP9Profile0";
429 case VAProfileVP9Profile1:
430 return os << "VAProfileVP9Profile1";
431 case VAProfileVP9Profile2:
432 return os << "VAProfileVP9Profile2";
433 case VAProfileVP9Profile3:
434 return os << "VAProfileVP9Profile3";
435 case VAProfileH264Baseline:
436 return os << "VAProfileH264Baseline";
437 case VAProfileH264ConstrainedBaseline:
438 return os << "VAProfileH264ConstrainedBaseline";
439 case VAProfileH264High:
440 return os << "VAProfileH264High";
441 case VAProfileH264Main:
442 return os << "VAProfileH264Main";
443 case VAProfileH264MultiviewHigh:
444 return os << "VAProfileH264MultiviewHigh";
445 case VAProfileH264StereoHigh:
446 return os << "VAProfileH264StereoHigh";
448 return os << "Unknown VAProfile: " << static_cast<int>(profile);
453 operator<<(std::ostream& os, const VAEntrypoint& entrypoint)
456 case VAEntrypointVLD:
457 return os << "VAEntrypointVLD";
458 case VAEntrypointIZZ:
459 return os << "VAEntrypointIZZ";
460 case VAEntrypointIDCT:
461 return os << "VAEntrypointIDCT";
462 case VAEntrypointMoComp:
463 return os << "VAEntrypointMoComp";
464 case VAEntrypointDeblocking:
465 return os << "VAEntrypointDeblocking";
466 case VAEntrypointVideoProc:
467 return os << "VAEntrypointVideoProc";
468 case VAEntrypointEncSlice:
469 return os << "VAEntrypointEncSlice";
470 case VAEntrypointEncSliceLP:
471 return os << "VAEntrypointEncSliceLP";
472 case VAEntrypointEncPicture:
473 return os << "VAEntrypointEncPicture";
475 return os << "Unknown VAEntrypoint: " << static_cast<int>(entrypoint);
479 #endif // I965_STREAMABLE_H