/** \file     EncCNNFilter.h
    \brief    encoder convolutional neural network-based filter class (header)
*/

#ifndef __ENCCNNFILTER__
#define __ENCCNNFILTER__

#include "CommonDef.h"
#include "Unit.h"
#include "Picture.h"
#include "Reshape.h"
#include "CABACWriter.h"
#include "CommonLib/CNNFilter.h"
//! \ingroup CommonLib
//! \{


class EncCNNFilter : public CNNFilter
{
public:
  EncCNNFilter();
  virtual ~EncCNNFilter();
  
  //for RDO
  CABACWriter*           m_CABACEstimator;
  CtxCache*              m_CtxCache;
  double                 m_lambda[MAX_NUM_COMPONENT];
  bool                   m_singleModelISlice;

  void                   initCABACEstimator( CABACEncoder* cabacEncoder, CtxCache* ctxCache, Slice* pcSlice );

#if SCALE_NN_RESIDUE
  void                   scaleFactorDerivation(Picture *pic, int paramIdx);
  void                   scalePicture(Picture* pic, int numParams);
#endif
  void                   cnnFilterEncoder(Picture *pic, const double *lambdas);
  void                   cnnFilterPicture(Picture* pic, int numParams);
#if SCALE_NN_RESIDUE
  void                   calcRDCost(Picture *pic, std::vector<PelStorage>& tempBuf, int numParams, double* minCost, bool scaled);
#else
  void                   calcRDCost(Picture *pic,std::vector<PelStorage>& tempBuf, int numParams, double* minCost)
#endif
};

//! \}
#endif

