diff options
author | U. Artie Eoff <ullysses.a.eoff@intel.com> | 2016-09-28 13:36:04 -0700 |
---|---|---|
committer | Sean V Kelley <seanvk@posteo.de> | 2016-10-03 11:30:39 -0700 |
commit | 034440cd4cee59f76ad211cb80108c1566561d10 (patch) | |
tree | 865bb6f5ccaec3d0d3c7bf4ad4062e401d2e0403 /test | |
parent | 393019134cfe9bde212b87f04362be4ad649e42c (diff) |
test: jpeg/enc: move TestInput impl to compilation unit
Move the implementation of JPEG::Encode::TestInput to the
compilation unit file (.cpp). This helps reduce the number
of include headers needed in the header file.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Reviewed-by: Sean V Kelley <seanvk@posteo.de>
Diffstat (limited to 'test')
-rw-r--r-- | test/i965_jpeg_encode_test.cpp | 2 | ||||
-rw-r--r-- | test/i965_jpeg_test_data.cpp | 89 | ||||
-rw-r--r-- | test/i965_jpeg_test_data.h | 101 | ||||
-rw-r--r-- | test/i965_test_fixture.h | 1 |
4 files changed, 98 insertions, 95 deletions
diff --git a/test/i965_jpeg_encode_test.cpp b/test/i965_jpeg_encode_test.cpp index a196c20..c587643 100644 --- a/test/i965_jpeg_encode_test.cpp +++ b/test/i965_jpeg_encode_test.cpp @@ -23,6 +23,8 @@ */ #include "i965_jpeg_test_data.h" +#include "i965_streamable.h" +#include "i965_test_fixture.h" #include "test_utils.h" #include <algorithm> diff --git a/test/i965_jpeg_test_data.cpp b/test/i965_jpeg_test_data.cpp index 7f327a5..84316a8 100644 --- a/test/i965_jpeg_test_data.cpp +++ b/test/i965_jpeg_test_data.cpp @@ -23,6 +23,8 @@ */ #include "i965_jpeg_test_data.h" +#include "i965_drv_video.h" +#include "i965_streamable.h" namespace JPEG { namespace Decode { @@ -764,3 +766,90 @@ namespace Decode { } // namespace Decode } // namespace JPEG + +namespace JPEG { +namespace Encode { + + TestInput::TestInput( + const unsigned fourcc, const unsigned w, const unsigned h) + : bytes() // caller must fill this in after instantiation + , picture(defaultPictureParameter) + , matrix(defaultIQMatrix) + , huffman(defaultHuffmanTable) + , slice(defaultSliceParameter) + , fourcc(fourcc) + , fourcc_output(fourcc) + , format(0) + , planes(0) + , widths{0,0,0} + , heights{0,0,0} + , offsets{0,0,0} + , sizes{0,0,0} + { + picture.picture_width = ALIGN(w, 2); + picture.picture_height = ALIGN(h, 2); + + switch(fourcc) { + case VA_FOURCC_I420: + planes = 3; + widths = {w + (w & 1), (w + 1) >> 1, (w + 1) >> 1}; + heights = {h + (h & 1), (h + 1) >> 1, (h + 1) >> 1}; + format = VA_RT_FORMAT_YUV420; + fourcc_output = VA_FOURCC_IMC3; + break; + case VA_FOURCC_NV12: + planes = 2; + widths = {w + (w & 1), w + (w & 1), 0}; + heights = {h + (h & 1), (h + 1) >> 1, 0}; + format = VA_RT_FORMAT_YUV420; + fourcc_output = VA_FOURCC_IMC3; + break; + default: + return; + } + + for (size_t i(0); i < planes; ++i) + sizes[i] = widths[i] * heights[i]; + + for (size_t i(1); i < planes; ++i) + offsets[i] = sizes[i - 1] + offsets[i - 1]; + } + + const unsigned TestInput::width() const + { + return picture.picture_width; + } + + const unsigned TestInput::height() const + { + return picture.picture_height; + } + + const uint8_t* TestInput::plane(const size_t i) const + { + return bytes.data() + offsets[i]; + } + + ::std::ostream& operator<<(::std::ostream& os, const TestInput& t) + { + return os + << std::string((char*)(&t.fourcc), 4) + << " " << t.width() << "x" << t.height() + << " " << t.widths << " " << t.heights + << " " << t.sizes << " " << t.offsets + ; + } + + ::std::ostream& operator<<(::std::ostream& os, const TestInput::Shared& t) + { + return os << *t; + } + + ::std::ostream& operator<<( + ::std::ostream& os, const TestInput::SharedConst& t) + { + return os << *t; + } + +} // namespace Encode +} // namespace JPEG diff --git a/test/i965_jpeg_test_data.h b/test/i965_jpeg_test_data.h index 64d5254..5f4802e 100644 --- a/test/i965_jpeg_test_data.h +++ b/test/i965_jpeg_test_data.h @@ -25,8 +25,6 @@ #ifndef I965_JPEG_TEST_DATA_H #define I965_JPEG_TEST_DATA_H -#include "i965_test_fixture.h" - #include <array> #include <iostream> #include <map> @@ -399,98 +397,15 @@ namespace Encode { typedef std::shared_ptr<TestInput> Shared; typedef std::shared_ptr<const TestInput> SharedConst; - TestInput(const unsigned fourcc, const unsigned w, const unsigned h) - : bytes() // caller must fill this in after instantiation - , picture(defaultPictureParameter) - , matrix(defaultIQMatrix) - , huffman(defaultHuffmanTable) - , slice(defaultSliceParameter) - , fourcc(fourcc) - , fourcc_output(fourcc) - , format(0) - , planes(0) - , widths{0,0,0} - , heights{0,0,0} - , offsets{0,0,0} - , sizes{0,0,0} - { - picture.picture_width = ALIGN(w,2); - picture.picture_height = ALIGN(h,2); - - switch(fourcc) { - case VA_FOURCC('I', '4', '2', '0'): - planes = 3; - widths = { - w +( w & 1), - (w + 1) >> 1, - (w + 1) >> 1 - }; - heights = { - h + (h & 1), - (h + 1) >> 1, - (h + 1) >> 1 - }; - format = VA_RT_FORMAT_YUV420; - fourcc_output = VA_FOURCC_IMC3; - break; - case VA_FOURCC_NV12: - planes = 2; - widths = { - w + (w & 1), - w + (w & 1), - 0 - }; - heights = { - h + (h & 1), - (h + 1) >> 1, - 0 - }; - format = VA_RT_FORMAT_YUV420; - fourcc_output = VA_FOURCC_IMC3; - break; - default: - return; - } - - for (size_t i(0); i < planes; ++i) { - sizes[i] = widths[i] * heights[i]; - } - - for (size_t i(1); i < planes; ++i) { - offsets[i] = sizes[i - 1]; - offsets[i] += offsets[i - 1]; - } - } - - const unsigned width() const - { - return picture.picture_width; - } - - const unsigned height() const - { - return picture.picture_height; - } + TestInput(const unsigned, const unsigned, const unsigned); - const uint8_t* plane(const size_t i) const - { - return bytes.data() + offsets[i]; - } + const unsigned width() const; + const unsigned height() const; + const uint8_t* plane(const size_t) const; - friend ::std::ostream& operator<<(::std::ostream& os, const TestInput& t) - { - return os - << std::string((char*)(&t.fourcc), 4) - << " " << t.width() << "x" << t.height() - << " " << t.widths << " " << t.heights - << " " << t.sizes << " " << t.offsets - ; - } - - friend ::std::ostream& operator<<(::std::ostream& os, const Shared& t) - { - return os << *t; - } + friend ::std::ostream& operator<<(::std::ostream&, const TestInput&); + friend ::std::ostream& operator<<(::std::ostream&, const Shared&); + friend ::std::ostream& operator<<(::std::ostream&, const SharedConst&); ByteData bytes; PictureParameter picture; @@ -506,8 +421,6 @@ namespace Encode { std::array<size_t, 3> offsets; std::array<size_t, 3> sizes; }; - - } // namespace Encode } // namespace JPEG diff --git a/test/i965_test_fixture.h b/test/i965_test_fixture.h index c805b35..dc6f6c4 100644 --- a/test/i965_test_fixture.h +++ b/test/i965_test_fixture.h @@ -27,7 +27,6 @@ #include "test.h" #include "i965_internal_decl.h" -#include "i965_streamable.h" #include <string> #include <vector> |