[Libav-user] 4k video decoding planner data

Harry Harry at gps-laptimer.de
Wed Jul 27 17:21:01 EEST 2016


Green borders are a wrong offset / starting address for the UV planes.

Harry

Sent from my smartphone

> On 27 Jul 2016, at 11:47, Ankush Wadke <wadkes93 at gmail.com> wrote:
> 
> Hi everybody,
>     I am stuck with a problem to which I am not able to figure out what exactly is wrong.
>     I am decoding a 4k video which gives me a YUV420P output frame. In order to convert it to UYVY I wrote a piece of code. which works fine for first frame, then second frame has a small green line and the third frame has the colors totally displaced. I am getting the correct frames sometimes but i am not able to figure out what is wrong with the other frames. 
>     It would be really helpful if someone would point me to something tat would help.
> 
> hers the code i am using for conversion,
> 
> void Convert_yuv420_to_yuv422(const AVFrame &videoBuffer, uint8_t * opBuffer, const int const &Width,  const int const &Height)
> {
> 	uint8_t  *buffer_uyvy_1strow = opBuffer, 
>                     *buffer_uyvy_2ndrow = opBuffer+(2*Width);
> 
> 	uint8_t		*y_1strow = videoBuffer.data[0],
> 				*y_2ndrow = videoBuffer.data[0]+Width;
> 
> 	uint8_t * u_ptr = videoBuffer.data[1];
> 	uint8_t * v_ptr = videoBuffer.data[2];
> 
> 	for (unsigned int i_conv_ht =0; i_conv_ht<Height;i_conv_ht+=2) {
> 		for (unsigned int i_conv_wt =0; i_conv_wt<Width;i_conv_wt+=2) {
> 			
> 			*buffer_uyvy_1strow++ = *u_ptr;
> 			*buffer_uyvy_1strow++ = *y_1strow++;
> 			*buffer_uyvy_1strow++ = *v_ptr;
> 			*buffer_uyvy_1strow++ = *y_1strow++;
> 
> 			*buffer_uyvy_2ndrow++ = *u_ptr;
> 			*buffer_uyvy_2ndrow++ = *y_2ndrow++;
> 			*buffer_uyvy_2ndrow++ = *v_ptr;
> 			*buffer_uyvy_2ndrow++ = *y_2ndrow++;
> 
> 			++u_ptr;
> 			++v_ptr;
> 		}
> 		y_1strow += Width;
> 		y_2ndrow += Width;
> 
> 		buffer_uyvy_1strow += FFALIGN((2*Width),1);
> 		buffer_uyvy_2ndrow += FFALIGN((2*Width),1);
> 	}
> }
> 
> Regards,
> Ankush
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160727/dd4bc653/attachment.html>


More information about the Libav-user mailing list