From 1eb1ffa329352dbbd4c5d6cf3e1ef08272e31957 Mon Sep 17 00:00:00 2001
From: chenke <chenke@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期四, 20 七月 2017 13:40:59 +0800
Subject: [PATCH] 缩放和中文字体稳定版,NV12转RGB565功能正常
---
RtspFace/PL_Scale.cpp | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/RtspFace/PL_Scale.cpp b/RtspFace/PL_Scale.cpp
index 4877fd1..8bc0574 100644
--- a/RtspFace/PL_Scale.cpp
+++ b/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:
--
Gitblit v1.8.0