Added y/uv stride as a parameter and remove the duplicate code. Change-Id: I019117a9dd9659a09d3d4e845d4814d3f33341b5