[FFmpeg-trac] #8871(swscale:new): swsscale crops image on yuv2rgb
FFmpeg
trac at avcodec.org
Fri Aug 28 14:01:45 EEST 2020
#8871: swsscale crops image on yuv2rgb
---------------------------------+---------------------------------------
Reporter: xlp | Type: defect
Status: new | Priority: normal
Component: swscale | Version: unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
---------------------------------+---------------------------------------
Summary of the bug:
swscale leaves a small right portion of the image out on yuv2rgb
conversion. aka "crops it", so a bar of the destination-image on right
side stays unwritten. this seems to effect only certain
resolutions/linesizes - below is one given that seems to cause issues
How to reproduce:
{{{
// HAS NO ISSUES
// int32_t width = 1600;
// int32_t height = 900;
// int srcLinesize[8] = {1664, 832, 832, 0, 0, 0, 0, 0};
// HAS ISSUES
int32_t width = 1220;
int32_t height = 1200;
int srcLinesize[8] = {1280, 640, 640, 0, 0, 0, 0, 0};
struct SwsContext* sws_scaler_ctx = sws_getContext(width, height,
AV_PIX_FMT_YUV420P,
width, height, AV_PIX_FMT_RGB0,
SWS_FAST_BILINEAR, 0, 0, 0);
size_t destBufferSize = width * 4 * height;
uint8_t* destBuffer = (uint8_t*) malloc(destBufferSize);
memset(destBuffer, 0x00, destBufferSize);
uint8_t* destLines[4] = {destBuffer, 0, 0, 0};
int destData[4] = {width * 4, 0, 0, 0};
// Make a dummy source with green footage
uint8_t* srcData[8];
for (int i = 0; i < 8; i++) {
if (srcLinesize[i] > 0) {
size_t srcBufferSize = srcLinesize[i]*height;
srcData[i] = (uint8_t*) malloc(srcBufferSize);
memset(srcData[i], 0x00, srcBufferSize);
} else {
srcData[i] = 0x00;
}
}
sws_scale(sws_scaler_ctx, (const uint8_t* const*)srcData, srcLinesize, 0,
height, destLines, destData);
}}}
Produced Result:
Green area with unwritten gap at the right side (here in the size of
4x1200)
Expected result:
Completely green area, as the provided YUV source contains
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8871>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list