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 {
|
|
|
|
virtual void onDecodeFrame(const Frame& frame) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
BaseDecoderTest();
|
|
|
|
void SetUp();
|
|
|
|
void TearDown();
|
|
|
|
void DecodeFile(const char* fileName, Callback* cbk);
|
|
|
|
|
2014-01-18 12:31:54 +01:00
|
|
|
bool Open(const char* fileName);
|
|
|
|
bool DecodeNextFrame(Callback* cbk);
|
|
|
|
|
2014-01-14 08:48:20 +01:00
|
|
|
private:
|
|
|
|
void DecodeFrame(const uint8_t* src, int sliceSize, Callback* cbk);
|
|
|
|
|
|
|
|
ISVCDecoder* decoder_;
|
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__
|