Jump to content
  • Advertisement
Sign in to follow this  
sp33dy

Unity Sws_scale problems

This topic is 4170 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Don't like to double post, but some people might not read my other post: Multiple movie formats Can anyone shed any light on the scaling problem I'm having (I've pasted full code listing into the other thread). Basically, I create a Texture of say 1024x1024 (assuming biggest avi is 640x480). I use Sws_scale to copy the latest ffmpeg movie frame into the texture buffer, but I don't seem to be able to find a way to scale it (ie, from 640x480 stretch out). 1. Is it possible to do this? 2. Any ideas what I need to change? I ask because I believe I've tried all the combinations.... Any help would be appreciated. Thanks and regards Sp33dy

Share this post


Link to post
Share on other sites
Advertisement
As a follow up, what's wrong with this:


pFrameRGB=avcodec_alloc_frame();
pFrame=avcodec_alloc_frame();

avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, 800, 600);
SwsContext *pSWSCtx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, 800, 600, PIX_FMT_RGB24, SWS_FAST_BILINEAR, NULL, NULL, NULL);

sws_scale(pSWSCtx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);





**Assuming I've read the pFrame data in at the point of sws_scale.

If I replace the 800x600 by the pCodecCtx width and height (happen to be 640x480), everything works well, I get a copy out at the same resolution of the video and I can apply the frame to my texture (which is 1024x1024, so lots of empty border).

I want to scale up to 800x600. However, with the above, I get an unhandled exception at the sws_scale call:

"First-chance exception at 0x6875b3b2 in lesson6.exe: 0xC0000005: Access violation writing location 0x08bf2000."

Any ideas?? Really would appreciate it

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!