[Libav-user] sws_scale slow on arm with big resolution

Olivier Roger oroger at prynel.com
Wed Aug 5 11:37:30 CEST 2015


Hello,

 

I'm using ffmpeg 2.7.2 on android to play rtsp streams. It's working pretty 

well until i hit big resolution (1920*1080 and over).

 

I have identified sws_scale as the bottleneck. On a samsung tablet

with a 2500*1600 display it take more than 100ms to convert YUV to RGB 

causing huge latency in the video stream.

 

This is how i do it : 

 

//get the scaling context

sws_ctx = sws_getContext (

     codecCtx->width,

     codecCtx->height,

     codecCtx->pix_fmt,

     pWidth,

     pHeight,

     AV_PIX_FMT_RGBA,

     SWS_FAST_BILINEAR,

     NULL,

     NULL,

     NULL

);

 

and then : 

 

avcodec_decode_video2(codecCtx, decodedFrame, &frameFinished,

&packet);

// Did we get a video frame?

if(frameFinished) {

     // Convert the image from its native format to RGBA

     sws_scale

     (

          sws_ctx,

          (uint8_t const * const *)decodedFrame->data,

          decodedFrame->linesize,

          0,

          codecCtx->height,

          frameRGBA->data,

          frameRGBA->linesize

     );

     

     //Render image

}

 

Is there a way to speed up this conversion ? It doesn't seems to be hardware
accelerated

 

Don't know if it can be relevant (newbie with ffmpeg) but this is how i
compiled ffmpeg for arm. 

I'm hoping for a magical flag which i may have forgotten :P  : 

 

configure \

      --prefix=$2 \

      --enable-shared \

      --enable-static \

      --disable-doc \

      --disable-ffmpeg \

      --disable-ffplay \

      --disable-ffprobe \

      --disable-ffserver \

      --disable-avdevice \

      --disable-doc \

      --disable-encoders \

      --disable-filters \

      --disable-decoders \

      --enable-network\

      --enable-protocol=tcp\

      --enable-demuxer=rtsp\

      --enable-symver \

      --enable-decoder=h264 \

      --enable-decoder=mpeg4 \

      --enable-decoder=mjpeg \

      --enable-parser=h264 \

      --enable-runtime-cpudetect \

      --cross-prefix=$3 \

      --target-os=linux \

      --enable-pic \

      --arch=arm \

      --enable-cross-compile \

      --sysroot=$5 \

      --extra-cflags="-Os -march=armv7-a -mfloat-abi=softfp" \

 

Thanks for your help

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20150805/e92c5982/attachment.html>


More information about the Libav-user mailing list