From a0ad020c02a5671849717d5726f15098f65a049e Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Mon, 26 Sep 2016 13:11:43 -0700 Subject: [PATCH] test: wrap jpeg decode tests and data in namespace Put the JPEG decode tests and test data into its own namespace so that it can be distinguished from encode. Signed-off-by: U. Artie Eoff Reviewed-by: Zhao Yakui (cherry picked from commit 55050bdfb168ec17db081bfa57ddedfd3e8ed222) --- test/i965_jpeg_decode_test.cpp | 8 ++--- test/i965_jpeg_test_data.cpp | 4 +++ test/i965_jpeg_test_data.h | 81 ++++++++++++++---------------------------- 3 files changed, 33 insertions(+), 60 deletions(-) diff --git a/test/i965_jpeg_decode_test.cpp b/test/i965_jpeg_decode_test.cpp index 24a30e6..b022c2e 100644 --- a/test/i965_jpeg_decode_test.cpp +++ b/test/i965_jpeg_decode_test.cpp @@ -34,12 +34,9 @@ #include namespace JPEG { +namespace Decode { -class JPEGDecodeTest : public I965TestFixture -{ -protected: - static const VAEntrypoint entrypoint = VAEntrypointVLD; -}; +class JPEGDecodeTest : public I965TestFixture { }; TEST_F(JPEGDecodeTest, Entrypoint) { @@ -324,4 +321,5 @@ INSTANTIATE_TEST_CASE_P( ::testing::Values("IMC3", "422H", "422V", "444P", "411P")) ); +} // namespace Decode } // namespace JPEG diff --git a/test/i965_jpeg_test_data.cpp b/test/i965_jpeg_test_data.cpp index 02d092c..7f327a5 100644 --- a/test/i965_jpeg_test_data.cpp +++ b/test/i965_jpeg_test_data.cpp @@ -25,6 +25,8 @@ #include "i965_jpeg_test_data.h" namespace JPEG { +namespace Decode { + /** * Test Pattern 1 * @@ -759,4 +761,6 @@ namespace JPEG { 0x00,0xa0,0x0f,0xff, }} }); + +} // namespace Decode } // namespace JPEG diff --git a/test/i965_jpeg_test_data.h b/test/i965_jpeg_test_data.h index 5a01e0e..d52f582 100644 --- a/test/i965_jpeg_test_data.h +++ b/test/i965_jpeg_test_data.h @@ -33,13 +33,29 @@ #include namespace JPEG { + typedef std::vector ByteData; + + static const VAProfile profile = VAProfileJPEGBaseline; + static inline const ByteData generateSolid( + const std::array& yuv, const std::array& dim) + { + size_t count(dim[0] * dim[1]); + ByteData data(count, yuv[0]); + data.insert(data.end(), count, yuv[1]); + data.insert(data.end(), count, yuv[2]); + return data; + } +} // namespace JPEG + +namespace JPEG { +namespace Decode { typedef VAIQMatrixBufferJPEGBaseline IQMatrix; typedef VAHuffmanTableBufferJPEGBaseline HuffmanTable; typedef VAPictureParameterBufferJPEGBaseline PictureParameter; typedef VASliceParameterBufferJPEGBaseline SliceParameter; - static const VAProfile profile = VAProfileJPEGBaseline; + static const VAEntrypoint entrypoint = VAEntrypointVLD; static const HuffmanTable defaultHuffmanTable = { load_huffman_table: { 0x01, 0x01 }, @@ -130,29 +146,11 @@ namespace JPEG { }; static const PictureParameter defaultPictureParameter = { - picture_width: 10, - picture_height: 10, - components: { - { - component_id: 1, - h_sampling_factor: 1, - v_sampling_factor: 1, - quantiser_table_selector: 0, - }, - { - component_id: 2, - h_sampling_factor: 1, - v_sampling_factor: 1, - quantiser_table_selector: 1, - }, - { - component_id: 3, - h_sampling_factor: 1, - v_sampling_factor: 1, - quantiser_table_selector: 1, - }, - }, - num_components: 3, + picture_width: 10, + picture_height: 10, + /* component_id, h_sampling_factor, v_sampling_factor, quantiser_table_selector */ + components: {{1,1,1,0}, {2,1,1,1}, {3,1,1,1}}, + num_components: 3, }; static const SliceParameter defaultSliceParameter = { @@ -162,30 +160,14 @@ namespace JPEG { slice_horizontal_position: 0, slice_vertical_position: 0, - components: { - { - component_selector: 1, - dc_table_selector: 0, - ac_table_selector: 0, - }, - { - component_selector: 2, - dc_table_selector: 1, - ac_table_selector: 1, - }, - { - component_selector: 3, - dc_table_selector: 1, - ac_table_selector: 1, - }, - }, + /* component_selector, dc_table_selector, ac_table_selector */ + components: {{1,0,0},{2,1,1},{3,1,1}}, + num_components: 3, restart_interval: 0, num_mcus: 4, }; - typedef std::vector ByteData; - class PictureData { public: @@ -336,18 +318,7 @@ namespace JPEG { static const bool m_valid; }; - - static inline const ByteData generateSolid( - const std::array& yuv, const std::array& dim) - { - size_t count(dim[0] * dim[1]); - ByteData data(count, yuv[0]); - data.insert(data.end(), count, yuv[1]); - data.insert(data.end(), count, yuv[2]); - return data; - } - - +} // namespace Decode } // namespace JPEG #endif -- 2.11.0