Hi!

The following code excerpt scales inFrame to outFrame.

Let the resolution of inFrame be 1024x768.

 

Scaling to resolutions with changed outWidth (800, 320, …) while keeping the
outHeight at 768 delivers a correct outFrame.

However if I change the values of outHeight < 768, the resulting image will
have the correct resolution, but all lines that correspond to the lines in
inFrame with number  (768-outHeight)…768 are black.

In the case of scaling(1024x768 -> 512 x 384) the lower half of the picture
would be black.

 

Here’s an excerpt from my code

 

//decode frame

avcodec_decode_video2 (CodecCtx, inFrame , &got_picture_ptr, &pkt);

 

// scale frame

static struct SwsContext* img_convert_ctx;

avpicture_alloc ((AVPicture*)outFrame, outPixFmt, outWidth, outHeight);

img_convert_ctx = sws_getContext (CodecCtx->width, CodecCtx->height,
CodecCtx->pix_fmt, outWidth, outHeight, outPixFmt, sws_flags, NULL, NULL,
NULL);

sws_scale(img_convert_ctx, inFrame->data, inFrame->linesize, 0, outHeight,
outFrame->data, outFrame->linesize);

 

After that outFrame->data seems to be allocated correctly but with the last
part of the array beeing 0.

 

Is this a known bug, or do I miss something?

Thanks for help.

 

Max.

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to