| | |
| | | #include "logger.h"
|
| | | #include <libyuv.h>
|
| | |
|
| | | #define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a))
|
| | |
|
| | | struct PL_Scale_Internal
|
| | | {
|
| | | uint8_t* buffer;
|
| | |
| | | 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()
|
| | | {
|
| | | }
|
| | |
|
| | |
| | |
|
| | | lastPmType = PipeMaterial::PMT_NONE;
|
| | |
|
| | | MB_Frame _lastFrame;
|
| | | lastFrame = _lastFrame;
|
| | | MB_Frame _tempFrame;
|
| | | tempFrame = _tempFrame;
|
| | |
|
| | | PL_Scale_Config _config;
|
| | | config = _config;
|
| | |
| | | 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;
|
| | |
| | | {
|
| | | 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;
|
| | |
| | | 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;
|
| | |
| | | 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:
|