// version 3.0 (C) 2001-2002 Joe Maller // Explanations available on my web site: // http://www.joemaller.com filter "Joe's Y/C Corrector" group "Joe's Filters"; input target, "Target", radiogroup, 2, "Luma (Y)", "Chroma (C)"; input Horizonatal, "Horizontal", slider, 0, -10, 10; input Vertical, "Vertical", slider, 0, -10, 10; input title, "www.joemaller.com", Label,""; InformationFlag("YUVaware"); ProducesAlpha code exposedbackground=1 float w, h, i, colorSpace, AspectRadius, filler; point sourceRect[4], destRect[4]; colorSpace = GetPixelFormat(dest); //store this for final conversion at the end dimensionsOf(Dest, w, h); float zoomfactor; zoomfactor = w/720; image xbuffer[w][h]; boundsOf(dest, sourceRect); destRect = sourceRect; for i = 0 to 3; DestRect[i].x += Horizonatal * zoomfactor; //moves DestRect to the origin point DestRect[i].y += Vertical * zoomfactor; next; filler = (target == 1) ? 0 : 128; ChannelFill(xbuffer, 0, filler, filler, filler); //sets a clean background to receive the rotated pixels BlitRect(src1, SourceRect, xbuffer, DestRect) //copies and rotates the source pixels if GetPixelFormat(xbuffer) != kFormatYUV219; ConvertImage(xbuffer, dest, kFormatYUV219); // dest contains offset image else dest = xbuffer; end if if GetPixelFormat(src1) != kFormatYUV219; ConvertImage(src1, xbuffer, kFormatYUV219); //xbuffer contains original image else xbuffer = src1; end if if target == 1 //shift luma ChannelCopy(xbuffer, dest, knone, knone, kgreen, kblue); else if target == 2 //shift chroma ChannelCopy(xbuffer, dest, knone, kred, knone, knone); end if if GetPixelFormat(dest) != colorSpace; //using colorspace makes this change back to whatever it started as ConvertImage(dest, xbuffer, colorSpace); setpixelformat(dest, colorSpace); dest = xbuffer; end if ChannelCopy(src1, dest, kalpha, knone, knone, knone);