[vlc-commits] atmo: fix handling of YV12 Frames (with hardware acceleration)
André Weber
git at videolan.org
Wed May 18 22:58:49 CEST 2011
vlc | branch: master | André Weber <atmo at videolan.org> | Wed May 18 22:42:49 2011 +0200| [fdbf760f8cd402f18a3709cbd61eb0eb1ed9ae7d] | committer: André Weber
atmo: fix handling of YV12 Frames (with hardware acceleration)
- exchange U and V plane to get the right colors again
- fixed some compiler warnings about signed - unsigned compare
- and some missing case entries
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdbf760f8cd402f18a3709cbd61eb0eb1ed9ae7d
---
modules/video_filter/atmo/AtmoMultiConnection.cpp | 4 ++--
modules/video_filter/atmo/AtmoTools.cpp | 4 ++++
modules/video_filter/atmo/atmo.cpp | 20 ++++++++++++++++++--
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/modules/video_filter/atmo/AtmoMultiConnection.cpp b/modules/video_filter/atmo/AtmoMultiConnection.cpp
index 393a391..01d1552 100644
--- a/modules/video_filter/atmo/AtmoMultiConnection.cpp
+++ b/modules/video_filter/atmo/AtmoMultiConnection.cpp
@@ -381,9 +381,9 @@ ATMO_BOOL CAtmoMultiConnection::setChannelValues(int numValues,unsigned char *ch
Lock();
- int Index = 0;
+ size_t Index = 0;
for (int i = 0; i < numValues; i+=2) {
- Index = (int)channel_values[i];
+ Index = (size_t)channel_values[i];
if(Index < sizeof(m_output))
m_output[Index] = channel_values[i + 1];
}
diff --git a/modules/video_filter/atmo/AtmoTools.cpp b/modules/video_filter/atmo/AtmoTools.cpp
index 2219a5e..45dfca6 100644
--- a/modules/video_filter/atmo/AtmoTools.cpp
+++ b/modules/video_filter/atmo/AtmoTools.cpp
@@ -128,6 +128,8 @@ EffectMode CAtmoTools::SwitchEffect(CAtmoDynData *pDynData, EffectMode newEffect
// neuen EffectThread nur mit aktiver Connection starten...
switch(newEffectMode) {
+ case emUndefined: // do nothing also in that case (avoid compiler warning)
+ break;
case emDisabled:
break;
@@ -223,6 +225,8 @@ LivePictureSource CAtmoTools::SwitchLiveSource(CAtmoDynData *pDynData, LivePictu
}
switch(pDynData->getLivePictureSource()) {
+ case lpsDisabled: // do nothing in that case - avoid compiler warning
+ break;
#if !defined(_ATMO_VLC_PLUGIN_)
case lpsScreenCapture:
input = new CAtmoGdiDisplayCaptureInput( pDynData );
diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
index 20070b4..381928c 100644
--- a/modules/video_filter/atmo/atmo.cpp
+++ b/modules/video_filter/atmo/atmo.cpp
@@ -735,6 +735,8 @@ struct filter_sys_t
bool b_show_dots;
int32_t i_device_type;
+ bool b_swap_uv;
+
int32_t i_atmo_width;
int32_t i_atmo_height;
/* used to disable fadeout if less than 50 frames are processed
@@ -1736,8 +1738,12 @@ static void Atmo_SetupParameters(filter_t *p_filter)
switch( p_filter->fmt_in.video.i_chroma )
{
case VLC_CODEC_I420:
+ p_sys->pf_extract_mini_image = ExtractMiniImage_YUV;
+ p_sys->b_swap_uv = false;
+ break;
case VLC_CODEC_YV12:
p_sys->pf_extract_mini_image = ExtractMiniImage_YUV;
+ p_sys->b_swap_uv = true;
break;
default:
msg_Warn( p_filter, "InitFilter-unsupported chroma: %4.4s",
@@ -2105,6 +2111,16 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
p_src_v = p_inpic->p[V_PLANE].p_pixels +
p_inpic->p[V_PLANE].i_pitch * i_v_row;
+ if(p_sys->b_swap_uv)
+ {
+ /*
+ swap u and v plane for YV12 images
+ */
+ uint8_t *p_temp_plane = p_src_u;
+ p_src_u = p_src_v;
+ p_src_v = p_temp_plane;
+ }
+
for(i_col = 1; i_col < i_col_count; i_col++)
{
i_pixel_col = (i_col * p_sys->i_crop_width) / i_col_count +
@@ -2292,7 +2308,7 @@ static picture_t * Filter( filter_t *p_filter, picture_t *p_pic )
{
filter_sys_t *p_sys = p_filter->p_sys;
if( !p_pic ) return NULL;
-
+
picture_t *p_outpic = filter_NewPicture( p_filter );
if( !p_outpic )
{
@@ -2300,7 +2316,7 @@ static picture_t * Filter( filter_t *p_filter, picture_t *p_pic )
return NULL;
}
picture_CopyPixels( p_outpic, p_pic );
-
+
vlc_mutex_lock( &p_sys->filter_lock );
if(p_sys->b_enabled && p_sys->pf_extract_mini_image &&
More information about the vlc-commits
mailing list