[FFmpeg-user] Flip in sws_scale

Ph0t0n lclemens at gmail.com
Thu May 12 01:05:44 CEST 2011


A filter would work, but if you're doing a conversion/scaling anyway with
sw_scale(), theoretically it's faster to flip at the same time.

I saw this posted somewhere else...

int nDivisor, nMaxLineSize = 0;
	// find max linesize
	for (int i = 0; i < 4; i++) { if (pic->linesize[i] > nMaxLineSize) {
nMaxLineSize = pic->linesize[i]; } }
	if (pic->linesize[0]) { nDivisor = (nMaxLineSize / pic->linesize[0]); if
(!nDivisor) { nDivisor = 1; } pic->data[0] += (pic->linesize[0] *
((nHeight/nDivisor) - 1)); }
	if (pic->linesize[1]) { nDivisor = (nMaxLineSize / pic->linesize[1]); if
(!nDivisor) { nDivisor = 1; } pic->data[1] += (pic->linesize[1] *
((nHeight/nDivisor) - 1)); }
	if (pic->linesize[2]) { nDivisor = (nMaxLineSize / pic->linesize[2]); if
(!nDivisor) { nDivisor = 1; } pic->data[2] += (pic->linesize[2] *
((nHeight/nDivisor) - 1)); }
	if (pic->linesize[3]) { nDivisor = (nMaxLineSize / pic->linesize[3]); if
(!nDivisor) { nDivisor = 1; } pic->data[3] += (pic->linesize[3] *
((nHeight/nDivisor) - 1)); }
	pic->linesize[0] *= -1;
	pic->linesize[1] *= -1;
	pic->linesize[2] *= -1;
	pic->linesize[3] *= -1;

--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/Flip-in-sws-scale-tp939665p3516095.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list