blob: 720c8636063065e002649184a535960da55ca3a1 [file] [log] [blame]
jwwang8247eef2014-01-14 15:48:20 +08001#ifndef __BASEDECODERTEST_H__
2#define __BASEDECODERTEST_H__
3
Martin Storsjöe88348b2014-01-24 10:29:27 +02004#include "test_stdint.h"
jwwang8247eef2014-01-14 15:48:20 +08005#include <limits.h>
jwwang0c2227e2014-01-18 19:31:54 +08006#include <fstream>
jwwang8247eef2014-01-14 15:48:20 +08007#include "codec_api.h"
8
jwwang0c2227e2014-01-18 19:31:54 +08009#include "utils/BufferedData.h"
10
jwwang8247eef2014-01-14 15:48:20 +080011class 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 {
huili2dc3fae42014-06-25 18:50:41 -070027 virtual void onDecodeFrame (const Frame& frame) = 0;
jwwang8247eef2014-01-14 15:48:20 +080028 };
29
30 BaseDecoderTest();
31 void SetUp();
32 void TearDown();
huili2dc3fae42014-06-25 18:50:41 -070033 void DecodeFile (const char* fileName, Callback* cbk);
jwwang8247eef2014-01-14 15:48:20 +080034
huili2dc3fae42014-06-25 18:50:41 -070035 bool Open (const char* fileName);
36 bool DecodeNextFrame (Callback* cbk);
huili2f82726d2014-08-12 18:31:41 -070037 ISVCDecoder* decoder_;
jwwang0c2227e2014-01-18 19:31:54 +080038
jwwang8247eef2014-01-14 15:48:20 +080039 private:
huili2dc3fae42014-06-25 18:50:41 -070040 void DecodeFrame (const uint8_t* src, int sliceSize, Callback* cbk);
jwwang8247eef2014-01-14 15:48:20 +080041
jwwang0c2227e2014-01-18 19:31:54 +080042 std::ifstream file_;
43 BufferedData buf_;
44 enum {
45 OpenFile,
46 Decoding,
47 EndOfStream,
48 End
49 } decodeStatus_;
jwwang8247eef2014-01-14 15:48:20 +080050};
51
52#endif //__BASEDECODERTEST_H__