Andrzej Ciarkowski <[email protected]> added the comment:

The code snippet which interfaces with swscale:

bool SwSurfaceConverter::Convert(const void* sourceFrameBytes, const size_t
sourceFrameByteSize, void* targetFrameBytes, const size_t targetFrameByteSize)
{
        if (GetSourceFrameByteSize() != sourceFrameByteSize)
                return false;
        if (GetTargetFrameByteSize() != targetFrameByteSize)
                return false;

        assert(NULL != sourcePicture_.get());
        assert(NULL != targetPicture_.get());

        const int w = int(GetWidth());
        const int h = int(GetHeight());

        avpicture_fill(sourcePicture_.get(), (uint8_t*)sourceFrameBytes,
sourcePixelFormat_, w, h);
        // hack: PIX_FMT_YUV420P is used both for YV12 and I420, we adjust plane
pointers as these formats differ by U & V plane positions
        if (videoSurfaceYV12 == GetSourceSurface())
                std::swap(sourcePicture_->data[1], sourcePicture_->data[2]);

        avpicture_fill(targetPicture_.get(), (uint8_t*)targetFrameBytes,
targetPixelFormat_, w, h);
        if (videoSurfaceYV12 == GetTargetSurface())
                std::swap(targetPicture_->data[1], targetPicture_->data[2]);

        int res = sws_scale(resampleContext_, sourcePicture_->data,
sourcePicture_->linesize, 0, h, targetPicture_->data, targetPicture_->linesize);
        return (res >= 0);
}

Running on x86 (Windows). sourcePicture_ and targetPicture_ are
std::auto_ptr<AVPicture>; resampleContext_ is initialized with call to
sws_getContext(w, h, sourceFormat, w, h, targetFormat, SWS_FAST_BILINEAR, NULL,
NULL, NULL) (the same problem occurs regardless of flags). libswscale is
compiled with all assembly code disabled, client code compiled with MSVC++ 9.

____________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/roundup/ffmpeg/issue881>
____________________________________________________

Reply via email to