@@ -619,34 +619,32 @@ static void r10k_to_bgr0(AVFrame * __restrict out_frame, unsigned char * __restr
619619 }
620620}
621621
622- static void rgb_rgba_to_gbrp (AVFrame * __restrict out_frame , unsigned char * __restrict in_data , int width , int height , bool rgba )
622+ static void rgb_rgba_to_gbrp (AVFrame * __restrict out_frame , unsigned char * __restrict in_data , int width , int height , int bpp )
623623{
624- int src_linesize = vc_get_linesize ( width , RGB ) ;
624+ int src_linesize = bpp * width ;
625625 for (int y = 0 ; y < height ; ++ y ) {
626626 unsigned char * src = in_data + y * src_linesize ;
627627 unsigned char * dst_g = out_frame -> data [0 ] + out_frame -> linesize [0 ] * y ;
628628 unsigned char * dst_b = out_frame -> data [1 ] + out_frame -> linesize [1 ] * y ;
629629 unsigned char * dst_r = out_frame -> data [2 ] + out_frame -> linesize [2 ] * y ;
630630
631631 OPTIMIZED_FOR (int x = 0 ; x < width ; ++ x ) {
632- * dst_r ++ = * src ++ ;
633- * dst_g ++ = * src ++ ;
634- * dst_b ++ = * src ++ ;
635- if (rgba ) {
636- src ++ ;
637- }
632+ * dst_r ++ = src [0 ];
633+ * dst_g ++ = src [1 ];
634+ * dst_b ++ = src [2 ];
635+ src += bpp ;
638636 }
639637 }
640638}
641639
642640static void rgb_to_gbrp (AVFrame * __restrict out_frame , unsigned char * __restrict in_data , int width , int height )
643641{
644- rgb_rgba_to_gbrp (out_frame , in_data , width , height , false );
642+ rgb_rgba_to_gbrp (out_frame , in_data , width , height , 3 );
645643}
646644
647645static void rgba_to_gbrp (AVFrame * __restrict out_frame , unsigned char * __restrict in_data , int width , int height )
648646{
649- rgb_rgba_to_gbrp (out_frame , in_data , width , height , true );
647+ rgb_rgba_to_gbrp (out_frame , in_data , width , height , 4 );
650648}
651649
652650static void r10k_to_gbrp10le (AVFrame * __restrict out_frame , unsigned char * __restrict in_data , int width , int height )
0 commit comments