Search code examples
libavcodeccolor-spacelibx264

Alternative to sws_scale


I am performing encoding of the captured windows screen with x264 using libavcodec. Since, the input is RGB, i am converting it to YUV to make it compatible with x264. I am using the sws_scale function for the same. My question is if there is any alternate for this function since i don't need any scaling to be done in my case. Also, it would be useful if someone could throw light on the workflow of this function.

P.S: I am assuming x264 operates only in YUV color space. If this assumption is incorrect, please inform me on the same.

Thanks in advance.


Solution

  • I could not find an alternative to swscale and it seems except the fast bilinear algorithm (for scaling) all other algorithms used in the library provide a fairly negligible color shift.
    Also, it is mathematically impossible to convert from RGB to YUV color space without any color shift (due to the approximations in the equations).
    P.S: I could not use the RGB version of libx264 / libavcodec. If you have details on how to implement and how to build a corresponding version on windows, please post links/info for the same.