[FFmpeg-user] Flip in sws_scale

erikjn ejanssen at itmatters.nl
Fri Mar 11 09:29:40 CET 2016


If the planes in the image are unequal size (e.g. YUV420) you need to adapt
the height.
There may be better ways to do it, but this works for me:

void FlipFrameJ420(AVFrame* pFrame) {
   for (int i = 0; i < 4; i++) {
      if (i) {
          pFrame->data[i] += pFrame->linesize[i] * ((pFrame->height >>
1)-1);
      }
      else {
          pFrame->data[i] += pFrame->linesize[i] * (pFrame->height-1);
      }
      pFrame->linesize[i] = -pFrame->linesize[i];
   }
}



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


More information about the ffmpeg-user mailing list