[Ffmpeg-devel] [RFC] VC1 frame decoder
Michael Niedermayer
michaelni
Sun Jan 21 17:03:00 CET 2007
Hi
On Sun, Jan 21, 2007 at 09:05:08AM +0200, Kostya wrote:
> Forgot to attach.
> Index: vc1.c
> ===================================================================
> --- libavcodec/vc1.c (revision 7590)
> +++ libavcodec/vc1.c (working copy)
> @@ -4222,10 +4222,29 @@
>
> //for advanced profile we need to unescape buffer
> if (avctx->codec_id == CODEC_ID_VC1) {
> - int i, buf_size2;
> + int i, buf_size2, skip = 0;
> buf2 = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
> buf_size2 = 0;
> - for(i = 0; i < buf_size; i++) {
> + // test if frame starts with some escape and seek to frame start
> + if(!buf[0] && !buf[1] && buf[2] == 1 && buf[3] != 3){
> + if(buf[3] == 0x0D || buf[3] == 0x0C){
> + skip = 4;
> + }else{
> + int code;
> + // search for frame/field start code
> + code = AV_RB32(buf);
> + while(skip < buf_size - 4){
> + code <<= 8;
> + code |= buf[skip++];
> + if(code == 0x0000010D || code == 0x0000010C) break;
> + }
> + if(skip == buf_size - 4){
> + av_log(avctx, AV_LOG_ERROR, "Frame begins with marker but no frame/field marker found\n");
> + return -1;
> + }
> + }
this looks a little more complex then needed, what does the
special skip=4 case do?
also int code is wrong, it has to be uint32_t or you must mask the bits above
32 away (int can be 64bit)
and maybe the code would be simpler if it would use ff_find_start_code() ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070121/da28caf1/attachment.pgp>
More information about the ffmpeg-devel
mailing list