annotate h261.c @ 12530:63edd10ad4bc libavcodec tip

Try to fix crashes introduced by r25218 r25218 made assumptions about the existence of past reference frames that weren't necessarily true.
author darkshikari
date Tue, 28 Sep 2010 09:06:22 +0000
parents 7dd2a45249a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
1 /*
5057
5b63f62602fa Split the h261.c file into separate files for the encoder, decoder and common stuff.
takis
parents: 4962
diff changeset
2 * H261 common code
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
3 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
4 * Copyright (c) 2004 Maarten Daniels
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
5 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
6 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
7 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
12 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
16 * Lesser General Public License for more details.
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
17 *
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3740
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
21 */
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
22
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
23 /**
11644
7dd2a45249a9 Remove explicit filename from Doxygen @file commands.
diego
parents: 8718
diff changeset
24 * @file
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
25 * h261codec.
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
26 */
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
27
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
28 #include "dsputil.h"
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
29 #include "avcodec.h"
5057
5b63f62602fa Split the h261.c file into separate files for the encoder, decoder and common stuff.
takis
parents: 4962
diff changeset
30 #include "h261.h"
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
31
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
32 #define IS_FIL(a) ((a)&MB_TYPE_H261_FIL)
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
33
5057
5b63f62602fa Split the h261.c file into separate files for the encoder, decoder and common stuff.
takis
parents: 4962
diff changeset
34 uint8_t ff_h261_rl_table_store[2][2*MAX_RUN + MAX_LEVEL + 3];
4668
1f1a0e67b961 kill av_mallocz_static() calls in init_rl()
michael
parents: 4206
diff changeset
35
2291
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
36 void ff_h261_loop_filter(MpegEncContext *s){
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
37 H261Context * h= (H261Context*)s;
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
38 const int linesize = s->linesize;
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
39 const int uvlinesize= s->uvlinesize;
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
40 uint8_t *dest_y = s->dest[0];
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
41 uint8_t *dest_cb= s->dest[1];
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
42 uint8_t *dest_cr= s->dest[2];
2291
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
43
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
44 if(!(IS_FIL (h->mtype)))
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
45 return;
c4e882a7c07c h.261 loop filter fix
michael
parents: 2290
diff changeset
46
2045
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
47 s->dsp.h261_loop_filter(dest_y , linesize);
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
48 s->dsp.h261_loop_filter(dest_y + 8, linesize);
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
49 s->dsp.h261_loop_filter(dest_y + 8 * linesize , linesize);
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
50 s->dsp.h261_loop_filter(dest_y + 8 * linesize + 8, linesize);
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
51 s->dsp.h261_loop_filter(dest_cb, uvlinesize);
9447bbd8a7e9 rewrite h261 loop filter
michael
parents: 2044
diff changeset
52 s->dsp.h261_loop_filter(dest_cr, uvlinesize);
2044
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
53 }
b6f2add2511e h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
diff changeset
54