annotate vp3_parser.c @ 12223:93e27a5401de libavcodec

Convert VP8 macroblock structures to a ring buffer. Uses a slightly nonintuitive ring buffer size of (width+height*2) to simplify addressing logic. Also split out the segmentation map to a separate structure, necessary to implement the ring buffer.
author darkshikari
date Thu, 22 Jul 2010 11:45:18 +0000
parents da33cd4590a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7145
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
1 /*
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
2 * Copyright (C) 2008 Michael Niedermayer
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
3 *
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
4 * This file is part of FFmpeg.
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
5 *
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
10 *
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
14 * Lesser General Public License for more details.
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
15 *
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
19 */
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
20
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
21 #include "parser.h"
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
22
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
23 static int parse(AVCodecParserContext *s,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
24 AVCodecContext *avctx,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
25 const uint8_t **poutbuf, int *poutbuf_size,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
26 const uint8_t *buf, int buf_size)
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
27 {
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
28 if(avctx->codec_id == CODEC_ID_THEORA)
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
29 s->pict_type= (buf[0]&0x40) ? FF_P_TYPE : FF_I_TYPE;
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
30 else
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
31 s->pict_type= (buf[0]&0x80) ? FF_P_TYPE : FF_I_TYPE;
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
32
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
33 *poutbuf = buf;
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
34 *poutbuf_size = buf_size;
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
35 return buf_size;
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
36 }
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
37
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
38 AVCodecParser vp3_parser = {
7147
da33cd4590a0 VP3 parser can also handle VP6 without any changes.
aurel
parents: 7145
diff changeset
39 { CODEC_ID_THEORA, CODEC_ID_VP3,
da33cd4590a0 VP3 parser can also handle VP6 without any changes.
aurel
parents: 7145
diff changeset
40 CODEC_ID_VP6, CODEC_ID_VP6F, CODEC_ID_VP6A },
7145
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
41 0,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
42 NULL,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
43 parse,
8c367046eb81 VP3 & Theora parser to extract keyframe flags.
michael
parents:
diff changeset
44 };