Please remove the setting of CODEC_CAP_TRUNCATED

在 Nov 17, 2011,9:59 PM,Shiju Sasi <[email protected]> 写道:

> Hi,
>  
> I have created a sample windows application using ffmpeg and x264 and 
> attached it's screenshot. In the application, I capture video and encode it 
> using x264, then decode it using ffmpeg and render it. My problem is large 
> amount of pixellation. I eliminated the possibility of rendering issues and 
> concluded that decoded and scaled output became pixellated.
>  
> Request your 2 minutes to review my working approach to see if I have missed 
> out anything obvious. I have copied only the relevant parts due to formatting 
> issues in gmail. If you can review to check if I have missed out any obvious 
> methods/settings as part of decoding, it will be really helpful.
>  
> FYI, I have allocated pCodecCtx in the below code using 
> avcodec_alloc_context3 and I have set only the coded_height, coded_width and 
> pix_fmt fields. I also use
> if(pDecoder->capabilities & CODEC_CAP_TRUNCATED)
> 
> pCodecCtx->flags|=CODEC_FLAG_TRUNCATED;
> 
> In the scale context, I use SWS_POINT flag for maximum quality.
> 
>  
> 
>  
> void decode_h264(const uint8_t* in_buf, int in_buf_size, uint8_t** out_buf, 
> int* out_buf_size)
> {
>    int got_picture = 0;
>    AVPacket avpkt;
>    av_init_packet(&avpkt);
>    while(in_buf_size > 0)
>    {
>       int len = 0;
>       len = av_parser_parse2(pDecoderParserContext,pCodecCtx, &avpkt.data, 
> &avpkt.size, in_buf, in_buf_size, 0, 0, 0);
>       in_buf += len;
>       in_buf_size -= len;
>       if(avpkt.size > 0)
>       {
>         avcodec_decode_video2(pCodecCtx, pFrame,&got_picture,&avpkt);
>        if(got_picture > 0)
>        {
>          sws_scale(decoderConvertCtx, pFrame->data, pFrame->linesize , 0, 
> pFrame->height, pOutFrame->data, pOutFrame->linesize);
>        }
>        *out_buf_size = userpOutFrame->linesize[0];
>        *out_buf = pOutFrame->data[0];
>       }
>    }
>  
> }
>  
> Thanks in advance,
> Shiju
>  
> 
> <pixellated.jpg>
> _______________________________________________
> Libav-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to