swscale is crash below code.
#include <stdio.h>
#include <libswscale/swscale.h>
int main()
{
int ww = 624; // crash
int hh = 352;
// int ww = 48; // crash
// int hh = 48;
// int ww = 64; // not crash
// int hh = 64;
int SwsFlag = SWS_POINT | SWS_ACCURATE_RND;
struct SwsContext *context = NULL;
uint8_t *src_data[4], *dst_data[4];
int src_pitch[4], dst_pitch[4];
context = sws_getCachedContext(context, ww, hh, PIX_FMT_YUV420P, ww, hh, PIX_FMT_YUVJ420P, SwsFlag, NULL, NULL, NULL);
src_data[0] = av_malloc(ww * hh);
src_data[1] = av_malloc(ww * hh / 4);
src_data[2] = av_malloc(ww * hh / 4);
src_data[3] = NULL;
dst_data[0] = av_malloc(ww * hh);
dst_data[1] = av_malloc(ww * hh / 4);
dst_data[2] = av_malloc(ww * hh / 4);
dst_data[3] = NULL;
src_pitch[0] = ww;
src_pitch[1] = ww / 2;
src_pitch[2] = ww / 2;
src_pitch[3] = 0;
dst_pitch[0] = ww;
dst_pitch[1] = ww / 2;
dst_pitch[2] = ww / 2;
dst_pitch[3] = 0;
sws_scale(context, src_data, src_pitch, 0, hh, dst_data, dst_pitch);
return 0;
}
No crash here (on linux) and nothing really suspicious under valgrind.
If the crash is still happening for you, please provide full gdb output and information about the platform and hardware on which it is crashing.