From 96630acb592df4dab17cf7cc26e73b69c108d09a Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 12 Jan 2015 00:48:12 +0000 Subject: [PATCH 1/3] Update PlaYUVerFrame::adjustSelectedAreaDims --- lib/PlaYUVerFrame.cpp | 48 +++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index b2e1ff4..817f8bc 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -188,14 +188,22 @@ Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame ) Void PlaYUVerFrame::adjustSelectedAreaDims( UInt& posX, UInt& posY, UInt& areaWidth, UInt& areaHeight, Int pelFormat ) { PlaYUVerFramePelFormat* pcPelFormat = &( g_PlaYUVerFramePelFormatsList[pelFormat] ); - if( posX % pcPelFormat->ratioChromaWidth ) - posX--; - if( posY % pcPelFormat->ratioChromaHeight ) - posY--; - if( ( posX + areaWidth ) % 2 ) - areaWidth++; - if( ( posY + areaHeight ) % 2 ) - areaHeight++; + if( pcPelFormat->ratioChromaWidth ) + { + if( posX % pcPelFormat->ratioChromaWidth ) + posX--; + if( ( posX + areaWidth ) % pcPelFormat->ratioChromaWidth ) + areaWidth++; + } + + if( pcPelFormat->ratioChromaHeight ) + { + if( posY % pcPelFormat->ratioChromaHeight ) + posY--; + + if( ( posY + areaHeight ) % pcPelFormat->ratioChromaHeight ) + areaHeight++; + } } Void PlaYUVerFrame::copyFrom( PlaYUVerFrame* input_frame, UInt xPos, UInt yPos ) @@ -314,19 +322,19 @@ Void PlaYUVerFrame::getCvMat( Void** ppCvFrame ) Int cvType = CV_8UC3; switch( m_iPixelFormat ) { - case YUV420p: - case YUV444p: - case YUV422p: - case YUYV422: + case YUV420p: + case YUV444p: + case YUV422p: + case YUYV422: cvType = CV_8UC4; break; - case GRAY: + case GRAY: cvType = CV_8UC1; break; - case RGB8: + case RGB8: cvType = CV_8UC3; break; - default: + default: break; } cv::Mat *pcCvFrame = new cv::Mat( m_uiHeight, m_uiWidth, cvType ); @@ -346,18 +354,18 @@ Void PlaYUVerFrame::getCvMat( Void** ppCvFrame ) Void PlaYUVerFrame::fromCvMat( Void* voidFrame ) { #ifdef USE_OPENCV - cv::Mat* opencvFrame = (cv::Mat*)voidFrame; + cv::Mat* opencvFrame = ( cv::Mat* )voidFrame; if( m_iPixelFormat == NO_FMT ) { switch( opencvFrame->channels() ) { - case 1: + case 1: m_iPixelFormat = GRAY; break; - case 4: + case 4: m_iPixelFormat = RGB8; break; - default: + default: return; } } @@ -376,7 +384,7 @@ Void PlaYUVerFrame::fromCvMat( Void* voidFrame ) Pel* pInputPelV = m_pppcInputPel[CHROMA_V][0]; Pel* pcRGBPelInterlaced = m_pcRGB32; memcpy( pcRGBPelInterlaced, opencvFrame->data, m_uiWidth * m_uiHeight * 4 * sizeof(Pel) ); - UInt* buff = (UInt*)pcRGBPelInterlaced; + UInt* buff = ( UInt* )pcRGBPelInterlaced; for( UInt i = 0; i < m_uiHeight * m_uiWidth; i++ ) { *pInputPelY++ = pelRed( *buff ); From c24c46a67cebe032d604a02c1bf931457b7a5e35 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 12 Jan 2015 01:03:00 +0000 Subject: [PATCH 2/3] Add COLOR_A --- lib/PlaYUVerDefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PlaYUVerDefs.h b/lib/PlaYUVerDefs.h index c1b3020..4ba0fe7 100644 --- a/lib/PlaYUVerDefs.h +++ b/lib/PlaYUVerDefs.h @@ -124,6 +124,7 @@ enum RGBcomponent COLOR_R = 0, COLOR_G, COLOR_B, + COLOR_A, }; } // NAMESPACE From 5a1ee43505b50de6ea8f12b3ccf0934bf1114f86 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Mon, 12 Jan 2015 01:17:49 +0000 Subject: [PATCH 3/3] Fix copyrights --- app/AboutDialog.cpp | 4 ++-- app/AboutDialog.h | 4 ++-- app/VideoSubWindow.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/AboutDialog.cpp b/app/AboutDialog.cpp index b9bc5ba..f2a355a 100644 --- a/app/AboutDialog.cpp +++ b/app/AboutDialog.cpp @@ -1,6 +1,6 @@ /* This file is a part of plaYUVer project - * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) - * Joao Carreira (jfmcarreira@gmail.com) + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/app/AboutDialog.h b/app/AboutDialog.h index 4938241..c1df08d 100644 --- a/app/AboutDialog.h +++ b/app/AboutDialog.h @@ -1,6 +1,6 @@ /* This file is a part of plaYUVer project - * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) - * Joao Carreira (jfmcarreira@gmail.com) + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index b87a50a..cdabab3 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -1,6 +1,6 @@ /* This file is a part of plaYUVer project - * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) - * Joao Carreira (jfmcarreira@gmail.com) + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by