Re: [Libav-user] sws_scale crash

2016-09-15 Thread Carl Eugen Hoyos
2016-09-15 2:54 GMT+02:00 YIRAN LI :

> Does that mean, as long as sws_scale is called, 16 extra
> bytes must be allocated?

Yes, this is always needed for input data in FFmpeg.

> what values should be set in these bytes?

The additional bytes should be initialized to 0 (I believe
this is not necessary for all operations, but the cost
should be negligible).

> does the data as whole (real data + 16 bytes) need to
> be aligned?

Yes, but it should not be possible to alloc memory in
FFmpeg that is not aligned (as all data has to be aligned).

Carl Eugen
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] sws_scale crash

2014-06-19 Thread wm4
On Thu, 19 Jun 2014 17:48:47 +1000
YIRAN LI  wrote:

> Hi, I met a crash when using sws_scale. So I'd like to see if anyone can
> help me here.
> 
> The input is a 1754x789 RGB24 image and I want to scale to 1280x576
> 
> swscontext is created successfully.
> 
> I create my own buffer to hold the image data, because it's RGB24 so the
> byteswith is 5264 (16 aligned) so the whole buffer is 5264x789.
> 
> The input AVFrame for sws_scale is created using avcode_alloc_frame(), and
> data[0] points to the buffer linesize[0] = 5264, and the output AVFrame is
> created using avpicture_alloc(rbg24, 1280, 576).

Never use anything related to avpicture. Use av_frame_get_buffer().
Strange name, but it allocates image data for the currently set
AVFrame size/pixelformat.

> 
> with all above condition, sws_scale crashed. So I'd like to know if there's
> any special requirement on the input/out buffer of sws_scale?
> 
> Thanks

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] sws_scale crash

2014-06-19 Thread YIRAN LI
> YIRAN LI  writes:
>
> > Hi, I met a crash when using sws_scale. So I'd like to see
> > if anyone can help me here.
>
> Source code, backtrace and FFmpeg version information missing.
>
> Thanks Carl,

I think it's not a bug of ffmpeg and the source AVFrame is not decoded from
ffmpeg but from our own decoder. Although the AVFrame is simple for RGB
format I guess sws_scale may have some requirements we didn't meet.
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] sws_scale crash

2014-06-19 Thread Carl Eugen Hoyos
YIRAN LI  writes:

> Hi, I met a crash when using sws_scale. So I'd like to see 
> if anyone can help me here.

Source code, backtrace and FFmpeg version information missing.

Carl Eugen

___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


Re: [Libav-user] sws_scale crash

2013-05-19 Thread YIRAN LI
Hi, you can check if pixel format ever changes between frames. Once up a
time I also had a crash problem, which I later found is caused by pixel
format change.


2013/5/19 yy-zed 

> Hi Guys,
>
> I'm trying to figure out to cause of constant crashes on sws_scale calls.
> I'm reading in a video frame, decoding it, then trying to scale, encode and
> write to video. Reading the frame and decoding it seem to be working fine,
> but sws_scale keeps crashing.
>
> Here's where I set the context:
>
>
> p_codec_ctx
>
> =p_in_video_ctx->p_fmt_ctx->streams[p_in_video_ctx->i_video_stream_idx]->codec;
>
> p_out_video_ctx->p_sws_ctx = sws_getContext(p_codec_ctx->width,
> p_codec_ctx->height, p_codec_ctx->pix_fmt,
> p_out_video_ctx->i_vwidth, p_out_video_ctx->i_vheight,
> AV_PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
>
> and here's where I make the call to scale the frame:
>
> debugLogR->debug("here1");
> sws_scale(p_out_video_ctx->p_sws_ctx,
> (uint8_t const * const *)
> p_in_video_ctx->p_video_frame->data,
> p_in_video_ctx->p_video_frame->linesize, 0,
> p_codec_ctx->height,
> p_out_video_ctx->p_video_frame->data,
> p_out_video_ctx->p_video_frame->linesize);
>
> debugLogR->debug("here2");
>
> here1 is printed, but the program exits with error code "-1073741819"
> before
> printing here2. Google tells me thats a general access memory violation.
>
> Has anybody got any ideas where I'm going wrong?
>
> Thanks,
> Sam
>
>
>
>
> --
> View this message in context:
> http://libav-users.943685.n4.nabble.com/sws-scale-crash-tp4657631.html
> Sent from the libav-users mailing list archive at Nabble.com.
> ___
> Libav-user mailing list
> Libav-user@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
___
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user