#ifndef ACCELERATION_SPEED_DCT_H
#define ACCELERATION_SPEED_DCT_H
#include "acceleration-speed.h"
#include "libde265/fallback-dct.h"
class DSPFunc_FDCT_Base : public DSPFunc
{
public:
DSPFunc_FDCT_Base(int size) {
residuals=NULL;
blkSize=size;
coeffs = new int16_t[size*size];
}
virtual const char* name() const { return "FDCT-Base"; }
virtual int getBlkWidth() const { return blkSize; }
virtual int getBlkHeight() const { return blkSize; }
virtual void runOnBlock(int x,int y) = 0;
void dump(int x,int y);
virtual DSPFunc* referenceImplementation() const { return NULL; }
bool compareToReferenceImplementation();
virtual bool prepareNextImage(std::shared_ptr<const de265_image> img);
private:
std::shared_ptr<const de265_image> prev_image;
std::shared_ptr<const de265_image> curr_image;
protected:
int blkSize;
int16_t* residuals;
int stride;
int16_t* coeffs;
};
class DSPFunc_IDCT_Base : public DSPFunc
{
public:
DSPFunc_IDCT_Base(int size) {
prev_image=NULL; curr_image=NULL; coeffs=NULL; blkSize=size;
out = new uint8_t[size*size];
}
virtual const char* name() const { return "IDCT-Base"; }
virtual int getBlkWidth() const { return blkSize; }
virtual int getBlkHeight() const { return blkSize; }
virtual void runOnBlock(int x,int y) = 0;
virtual DSPFunc* referenceImplementation() const { return NULL; }
virtual bool compareToReferenceImplementation();
virtual bool prepareNextImage(std::shared_ptr<const de265_image> img);
inline int16_t* xy2coeff(int x,int y) const {
int offset = (x+y*blksPerRow)*blkSize;
return coeffs + offset;
}
private:
std::shared_ptr<const de265_image> prev_image;
std::shared_ptr<const de265_image> curr_image;
protected:
int blkSize;
int16_t* coeffs;
int width;
int blksPerRow;
uint8_t* out;
};
#endif