jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 1 | #ifndef __BASEDECODERTEST_H__ |
| 2 | #define __BASEDECODERTEST_H__ |
| 3 | |
Martin Storsjö | e88348b | 2014-01-24 10:29:27 +0200 | [diff] [blame] | 4 | #include "test_stdint.h" |
jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 5 | #include <limits.h> |
jwwang | 0c2227e | 2014-01-18 19:31:54 +0800 | [diff] [blame] | 6 | #include <fstream> |
jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 7 | #include "codec_api.h" |
| 8 | |
jwwang | 0c2227e | 2014-01-18 19:31:54 +0800 | [diff] [blame] | 9 | #include "utils/BufferedData.h" |
| 10 | |
jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 11 | class BaseDecoderTest { |
| 12 | public: |
| 13 | struct Plane { |
| 14 | const uint8_t* data; |
| 15 | int width; |
| 16 | int height; |
| 17 | int stride; |
| 18 | }; |
| 19 | |
| 20 | struct Frame { |
| 21 | Plane y; |
| 22 | Plane u; |
| 23 | Plane v; |
| 24 | }; |
| 25 | |
| 26 | struct Callback { |
| 27 | virtual void onDecodeFrame(const Frame& frame) = 0; |
| 28 | }; |
| 29 | |
| 30 | BaseDecoderTest(); |
| 31 | void SetUp(); |
| 32 | void TearDown(); |
| 33 | void DecodeFile(const char* fileName, Callback* cbk); |
| 34 | |
jwwang | 0c2227e | 2014-01-18 19:31:54 +0800 | [diff] [blame] | 35 | bool Open(const char* fileName); |
| 36 | bool DecodeNextFrame(Callback* cbk); |
| 37 | |
jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 38 | private: |
| 39 | void DecodeFrame(const uint8_t* src, int sliceSize, Callback* cbk); |
| 40 | |
| 41 | ISVCDecoder* decoder_; |
jwwang | 0c2227e | 2014-01-18 19:31:54 +0800 | [diff] [blame] | 42 | std::ifstream file_; |
| 43 | BufferedData buf_; |
| 44 | enum { |
| 45 | OpenFile, |
| 46 | Decoding, |
| 47 | EndOfStream, |
| 48 | End |
| 49 | } decodeStatus_; |
jwwang | 8247eef | 2014-01-14 15:48:20 +0800 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | #endif //__BASEDECODERTEST_H__ |