[vlc-commits] commit: Fixed crop parameters in transform filter. (Laurent Aimar )
git at videolan.org
git at videolan.org
Fri Nov 26 22:37:42 CET 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Nov 12 03:26:13 2010 +0100| [351139f592525158be8b6fe55c94ebb945568287] | committer: Laurent Aimar
Fixed crop parameters in transform filter.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=351139f592525158be8b6fe55c94ebb945568287
---
modules/video_filter/transform.c | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/modules/video_filter/transform.c b/modules/video_filter/transform.c
index a3242b4..72dcd70 100644
--- a/modules/video_filter/transform.c
+++ b/modules/video_filter/transform.c
@@ -177,12 +177,13 @@ static int Mouse(filter_t *filter, vlc_mouse_t *mouse,
static int Open(vlc_object_t *object)
{
filter_t *filter = (filter_t *)object;
+ const video_format_t *src = &filter->fmt_in.video;
+ video_format_t *dst = &filter->fmt_out.video;
const vlc_chroma_description_t *chroma =
- vlc_fourcc_GetChromaDescription(filter->fmt_in.video.i_chroma);
+ vlc_fourcc_GetChromaDescription(src->i_chroma);
if (!chroma || chroma->plane_count < 3) {
- msg_Err(filter, "Unsupported chroma (%4.4s)",
- (char*)&filter->fmt_in.video.i_chroma);
+ msg_Err(filter, "Unsupported chroma (%4.4s)", (char*)&src->i_chroma);
/* TODO support packed and rgb */
return VLC_EGENERIC;
}
@@ -213,8 +214,6 @@ static int Open(vlc_object_t *object)
free(sys);
return VLC_EGENERIC;
}
- const video_format_t *src = &filter->fmt_in.video;
- video_format_t *dst = &filter->fmt_out.video;
dst->i_width = src->i_height;
dst->i_visible_width = src->i_visible_height;
@@ -222,18 +221,18 @@ static int Open(vlc_object_t *object)
dst->i_visible_height = src->i_visible_width;
dst->i_sar_num = src->i_sar_den;
dst->i_sar_den = src->i_sar_num;
+ }
- dst->i_x_offset = INT_MAX;
- dst->i_y_offset = INT_MIN;
- for (int i = 0; i < 2; i++) {
- int tx, ty;
- sys->dsc->iconvert(&tx, &ty,
- src->i_width, src->i_height,
- src->i_x_offset + i * src->i_visible_width,
- src->i_y_offset + i * src->i_visible_height);
- dst->i_x_offset = __MIN(dst->i_x_offset, (unsigned)tx);
- dst->i_y_offset = __MIN(dst->i_y_offset, (unsigned)ty);
- }
+ dst->i_x_offset = INT_MAX;
+ dst->i_y_offset = INT_MAX;
+ for (int i = 0; i < 2; i++) {
+ int tx, ty;
+ sys->dsc->iconvert(&tx, &ty,
+ src->i_width, src->i_height,
+ src->i_x_offset + i * (src->i_visible_width - 1),
+ src->i_y_offset + i * (src->i_visible_height - 1));
+ dst->i_x_offset = __MIN(dst->i_x_offset, (unsigned)(1 + tx));
+ dst->i_y_offset = __MIN(dst->i_y_offset, (unsigned)(1 + ty));
}
filter->p_sys = sys;
More information about the vlc-commits
mailing list