<html><body bgcolor="#FFFFFF"><div><br>Please remove the setting of CODEC_CAP_TRUNCATED</div><div><br>在 Nov 17, 2011,9:59 PM,Shiju Sasi <<a href="mailto:sasishiju@gmail.com">sasishiju@gmail.com</a>> 写道:<br><br></div><div></div><blockquote type="cite"><div><div class="gmail_quote"><div>Hi,</div><div> </div><div>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.</div>
<div> </div><div>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.</div>
<div> </div><div>FYI, I have allocated pCodecCtx in the below code using <font size="2">avcodec_alloc_context3 and I have set only the coded_height, coded_width and pix_fmt fields. I also use </font></div><div><p><font color="#0000ff" size="2"><font color="#0000ff" size="2">if</font></font><font size="2">(pDecoder->capabilities & CODEC_CAP_TRUNCATED)</font></p>
<p><font size="2">pCodecCtx->flags|=CODEC_FLAG_TRUNCATED;</font></p><p><font size="2">In the scale context, I use SWS_POINT flag for maximum quality. </font></p><p><font size="2"> </font></p><font size="2"></font></div>
<div> </div><div>void <font size="2">decode_h264(</font><font color="#0000ff" size="2"><font color="#0000ff" size="2">const</font></font><font size="2"> uint8_t* in_buf, </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2"> in_buf_size, uint8_t** out_buf, </font><font color="#0000ff" size="2"><font color="#0000ff" size="2">int</font></font><font size="2">* out_buf_size)</font></div>
<div>{</div><div> int got_picture = 0;</div><div> AVPacket avpkt;</div><div> av_init_packet(&avpkt);</div><div> while(in_buf_size > 0)</div><div> {</div><div> int len = 0;</div><div> len = <font size="2">av_parser_parse2(pDecoderParserContext,pCodecCtx, &avpkt.data, &avpkt.size, in_buf, in_buf_size, 0, 0, 0);</font></div>
<div> in_buf += len;</div><div> in_buf_size -= len;</div><div> if(avpkt.size > 0)</div><div> {</div><div> <font size="2">avcodec_decode_video2(pCodecCtx, pFrame,&got_picture,&avpkt);</font></div>
<div> if(got_picture > 0)</div><div> {</div><div> s<font size="2">ws_scale(decoderConvertCtx, pFrame->data, pFrame->linesize , 0, pFrame->height, pOutFrame->data, pOutFrame->linesize);</font></div>
<div> }</div><div> <font size="2">*out_buf_size = userpOutFrame->linesize[0];
</font></div><div><font size="2"> *out_buf = pOutFrame->data[0];</font></div><div> }</div><div> }</div><div> </div><font size="2"></font><div>}<font size="2"></font></div><div> </div><div>
Thanks in advance,</div><div>Shiju</div><font color="#888888"><div> </div>
</font></div><br>
</div></blockquote><blockquote type="cite"><div><pixellated.jpg></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Libav-user mailing list</span><br><span><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a></span><br><span><a href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a></span><br></div></blockquote></body></html>