Opened 4 years ago

Closed 4 years ago

#8970 closed defect (duplicate)

swscale crash

Reported by: Darko Jurić Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Program is crashing when using swscale (yuv420p->bgr24) on an target image with alignment 1. The underlying OS is Ubuntu 18.04LTS Server edition. The code is working fine on Windows 10, Ubuntu18.04LTS Desktop, OSX.

#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>

typedef unsigned char byte;

void yuv420ToBgr24(uint8_t* srcData[4], int srcStride[4], uint8_t* tgtData[4], int tgtStride[4], int w, int h)
{
	struct SwsContext* context = sws_getContext(w, h, AV_PIX_FMT_YUV420P,
		                                        w, h, AV_PIX_FMT_BGR24, 
		                                        SWS_FAST_BILINEAR | SWS_BITEXACT, NULL, NULL, NULL);
	{
		sws_scale(context,
			      srcData, srcStride, 0, h,
			      tgtData, tgtStride);
	}
	sws_freeContext(context);
}

void main()
{
	int w = 854; int h = 400;

	uint8_t* yuvData[4]; int yuvStride[4];
	av_image_alloc(yuvData, yuvStride, w, h, AV_PIX_FMT_YUV420P, 16);

	uint8_t* bgrData[4]; int bgrStride[4];
	av_image_alloc(bgrData, bgrStride, w, h, AV_PIX_FMT_BGR24, 1); //if align is 1 then segfault is obtained

	yuv420ToBgr24(yuvData, yuvStride, bgrData, bgrStride, w, h);
	printf("done\n");
}

Attachments (1)

Untitled.png (36.8 KB ) - added by Darko Jurić 4 years ago.

Download all attachments as: .zip

Change History (2)

by Darko Jurić, 4 years ago

Attachment: Untitled.png added

comment:1 by Carl Eugen Hoyos, 4 years ago

Component: swscaleundetermined
Priority: importantnormal
Reproduced by developer: unset
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.