xuxiuxi
2017-07-23 94e704acde59df60bd42f6f90b94d462d1bfa37c
RtspFace/PL_Scale.cpp
@@ -3,6 +3,8 @@
#include "logger.h"
#include <libyuv.h>
#define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a))
struct PL_Scale_Internal
{
   uint8_t* buffer;
@@ -11,12 +13,12 @@
   bool payError;
   
   PipeMaterial::PipeMaterialBufferType lastPmType;
   MB_Frame lastFrame;
   MB_Frame tempFrame;
   PL_Scale_Config config;
   PL_Scale_Internal() : 
      buffer(nullptr), buffSize(0), buffSizeMax(0), payError(true), 
      lastPmType(PipeMaterial::PMT_NONE), lastFrame(), config()
      lastPmType(PipeMaterial::PMT_NONE), tempFrame(), config()
   {
   }
   
@@ -33,8 +35,8 @@
      
      lastPmType = PipeMaterial::PMT_NONE;
      
      MB_Frame _lastFrame;
      lastFrame = _lastFrame;
      MB_Frame _tempFrame;
      tempFrame = _tempFrame;
      
      PL_Scale_Config _config;
      config = _config;
@@ -92,7 +94,6 @@
bool image_scale(PL_Scale_Internal* in, 
   uint8_t* srcBuffer, MB_Frame::MBFType srcType, uint16_t srcWidth, uint16_t srcHeight)
{
#define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a))
   const int dst_width = in->config.toWidth;
   const int dst_height = in->config.toHeight;
@@ -213,7 +214,7 @@
      {
      case MB_Frame::MBFT_YUV420:
      case MB_Frame::MBFT_BGRA:
         in->lastFrame = *frame;
         in->tempFrame = *frame;
         ret = image_scale(in, (uint8_t*)frame->buffer, frame->type,
            frame->width, frame->height);
         break;
@@ -238,7 +239,7 @@
                  case MB_Frame::MBFT_YUV420:
                  case MB_Frame::MBFT_BGRA:
                  case MB_Frame::MBFT_NV12:
                     in->lastFrame = *frame;
                     in->tempFrame = *frame;
                     ret = image_scale(in, (uint8_t*)frame->buffer,frame->type,
                                   frame->width, frame->height);
                     break;
@@ -279,13 +280,13 @@
   case PipeMaterial::PMT_PM_LIST:
   {
      newPm.type = PipeMaterial::PMT_FRAME;
      newPm.buffer = &(in->lastFrame);
      newPm.buffer = &(in->tempFrame);
      newPm.buffSize = 0;
      in->lastFrame.buffer = in->buffer;
      in->lastFrame.buffSize = in->buffSize;
      in->lastFrame.width = in->config.toWidth;
      in->lastFrame.height = in->config.toHeight;
      in->tempFrame.buffer = in->buffer;
      in->tempFrame.buffSize = in->buffSize;
      in->tempFrame.width = in->config.toWidth;
      in->tempFrame.height = in->config.toHeight;
   }
   break;
   default: