|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-02 02:16:35
|
Module: performous
Branch: opengl2
Commit: 26f91bfcc062c1f7d2bda2370468523b7f1c7cfd
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Dec 23 15:20:27 2010 +0100
Scaled nicely non-nicely aligned videos (could maybe lead to small aspect ratio errors
---
game/ffmpeg.cc | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 5c136f3..58c4f0b 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -101,10 +101,10 @@ void FFmpeg::open() {
}
// Setup software scaling context for YUV to RGB conversion
if (videoStream != -1 && decodeVideo) {
- width = pVideoCodecCtx->width;
- height = pVideoCodecCtx->height;
+ width = (pVideoCodecCtx->width+15)&~15;
+ height = (pVideoCodecCtx->height+15)&~15;
img_convert_ctx = sws_getContext(
- width, height, pVideoCodecCtx->pix_fmt,
+ pVideoCodecCtx->width, pVideoCodecCtx->height, pVideoCodecCtx->pix_fmt,
width, height, PIX_FMT_RGB24,
SWS_POINT, NULL, NULL, NULL);
}
@@ -242,8 +242,8 @@ void FFmpeg::decodeNextFrame() {
packetData += decodeSize;
if (frameFinished) {
// Convert into RGB and scale the data
- int w = pVideoCodecCtx->width;
- int h = pVideoCodecCtx->height;
+ int w = (pVideoCodecCtx->width+15)&~15;
+ int h = (pVideoCodecCtx->height+15)&~15;
std::vector<uint8_t> buffer(w * h * 3);
{
uint8_t* data = &buffer[0];
|