Mercurial > libavcodec.hg
annotate rv10enc.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 |
| rev | line source |
|---|---|
| 0 | 1 /* |
| 10018 | 2 * RV10 encoder |
|
8629
04423b2f6e0b
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
8590
diff
changeset
|
3 * Copyright (c) 2000,2001 Fabrice Bellard |
|
1739
07a484280a82
copyright year update of the files i touched and remembered, things look annoyingly unmaintained otherwise
michael
parents:
1706
diff
changeset
|
4 * Copyright (c) 2002-2004 Michael Niedermayer |
| 0 | 5 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3796
diff
changeset
|
6 * This file is part of FFmpeg. |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3796
diff
changeset
|
7 * |
|
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3796
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
| 429 | 9 * modify it under the terms of the GNU Lesser General Public |
| 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:
3796
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
| 0 | 12 * |
|
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3796
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
| 0 | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 429 | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Lesser General Public License for more details. | |
| 0 | 17 * |
| 429 | 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:
3796
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:
2979
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 0 | 21 */ |
| 1106 | 22 |
| 23 /** | |
|
11644
7dd2a45249a9
Remove explicit filename from Doxygen @file commands.
diego
parents:
11560
diff
changeset
|
24 * @file |
| 10018 | 25 * RV10 encoder |
| 1106 | 26 */ |
| 2967 | 27 |
| 0 | 28 #include "mpegvideo.h" |
| 10018 | 29 #include "put_bits.h" |
| 0 | 30 |
| 31 void rv10_encode_picture_header(MpegEncContext *s, int picture_number) | |
| 32 { | |
|
712
e55b91623e09
fixing rv10, this isnt the cleanest solution (parsing the packet header in the codec & creating it in the muxer) but it was that way before things broke, and its the simplest solution
michaelni
parents:
646
diff
changeset
|
33 int full_frame= 0; |
|
646
f87dc45d921d
fixing rv10 encoding (ffmpeg can at least decode its own rv10 files now)
michaelni
parents:
643
diff
changeset
|
34 |
| 0 | 35 align_put_bits(&s->pb); |
| 2967 | 36 |
| 2979 | 37 put_bits(&s->pb, 1, 1); /* marker */ |
| 0 | 38 |
| 6481 | 39 put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE)); |
| 0 | 40 |
| 2979 | 41 put_bits(&s->pb, 1, 0); /* not PB frame */ |
| 0 | 42 |
| 43 put_bits(&s->pb, 5, s->qscale); | |
| 44 | |
| 6481 | 45 if (s->pict_type == FF_I_TYPE) { |
| 2979 | 46 /* specific MPEG like DC coding not used */ |
| 0 | 47 } |
| 48 /* if multiple packets per frame are sent, the position at which | |
| 7980 | 49 to display the macroblocks is coded here */ |
|
646
f87dc45d921d
fixing rv10 encoding (ffmpeg can at least decode its own rv10 files now)
michaelni
parents:
643
diff
changeset
|
50 if(!full_frame){ |
| 2979 | 51 put_bits(&s->pb, 6, 0); /* mb_x */ |
| 52 put_bits(&s->pb, 6, 0); /* mb_y */ | |
|
646
f87dc45d921d
fixing rv10 encoding (ffmpeg can at least decode its own rv10 files now)
michaelni
parents:
643
diff
changeset
|
53 put_bits(&s->pb, 12, s->mb_width * s->mb_height); |
|
f87dc45d921d
fixing rv10 encoding (ffmpeg can at least decode its own rv10 files now)
michaelni
parents:
643
diff
changeset
|
54 } |
| 0 | 55 |
| 2979 | 56 put_bits(&s->pb, 3, 0); /* ignored */ |
| 0 | 57 } |
| 1655 | 58 |
|
10012
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
59 AVCodec rv10_encoder = { |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
60 "rv10", |
|
11560
8a4984c5cacc
Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents:
10146
diff
changeset
|
61 AVMEDIA_TYPE_VIDEO, |
|
10012
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
62 CODEC_ID_RV10, |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
63 sizeof(MpegEncContext), |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
64 MPV_encode_init, |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
65 MPV_encode_picture, |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
66 MPV_encode_end, |
|
10146
38cfe222e1a4
Mark all pix_fmts and supported_framerates compound literals as const.
reimar
parents:
10018
diff
changeset
|
67 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE}, |
|
10012
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
68 .long_name= NULL_IF_CONFIG_SMALL("RealVideo 1.0"), |
|
fef7b43f0d22
Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents:
10008
diff
changeset
|
69 }; |
