2014-01-14 08:48:20 +01:00
|
|
|
#ifndef __BASEDECODERTEST_H__
|
|
|
|
#define __BASEDECODERTEST_H__
|
|
|
|
|
2014-01-24 09:29:27 +01:00
|
|
|
#include "test_stdint.h"
|
2014-01-14 08:48:20 +01:00
|
|
|
#include <limits.h>
|
2014-01-18 12:31:54 +01:00
|
|
|
#include <fstream>
|
2014-01-14 08:48:20 +01:00
|
|
|
#include "codec_api.h"
|
|
|
|
|
2014-01-18 12:31:54 +01:00
|
|
|
#include "utils/BufferedData.h"
|
|
|
|
|
2014-01-14 08:48:20 +01:00
|
|
|
class BaseDecoderTest {
|
|
|
|
public:
|
|
|
|
struct Plane {
|
|
|
|
const uint8_t* data;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int stride;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Frame {
|
|
|
|
Plane y;
|
|
|
|
Plane u;
|
|
|
|
Plane v;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Callback {
|
2014-06-26 03:50:41 +02:00
|
|
|
virtual void onDecodeFrame (const Frame& frame) = 0;
|
2014-01-14 08:48:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
BaseDecoderTest();
|
2016-03-04 08:49:32 +01:00
|
|
|
int32_t SetUp();
|
2014-01-14 08:48:20 +01:00
|
|
|
void TearDown();
|
2014-06-26 03:50:41 +02:00
|
|
|
void DecodeFile (const char* fileName, Callback* cbk);
|
2014-01-14 08:48:20 +01:00
|
|
|
|
2014-06-26 03:50:41 +02:00
|
|
|
bool Open (const char* fileName);
|
|
|
|
bool DecodeNextFrame (Callback* cbk);
|
2014-08-13 03:31:41 +02:00
|
|
|
ISVCDecoder* decoder_;
|
2014-01-18 12:31:54 +01:00
|
|
|
|
2014-01-14 08:48:20 +01:00
|
|
|
private:
|
2015-01-16 09:50:01 +01:00
|
|
|
void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
|
2014-01-14 08:48:20 +01:00
|
|
|
|
2014-01-18 12:31:54 +01:00
|
|
|
std::ifstream file_;
|
|
|
|
BufferedData buf_;
|
|
|
|
enum {
|
|
|
|
OpenFile,
|
|
|
|
Decoding,
|
|
|
|
EndOfStream,
|
|
|
|
End
|
|
|
|
} decodeStatus_;
|
2014-01-14 08:48:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //__BASEDECODERTEST_H__
|