annotate rv10enc.c @ 10960:10759fd39860 libavcodec

Gcc idiocy fixes related to filter_mb_edge*. Change order of operands as gcc uses a hardcoded register per operand it seems even for static functions thus reducing unneeded moved (now functions try to pass the same argument in the same spot). Change signed int to unsigned int for array indexes as signed requires signed extension while unsigned is free. move the +52 up and merge it where it will end as a lea instruction, gcc always splits the 52 out there turning the free +52 into an expensive one otherwise. The changed code becomes a little faster.
author michael
date Fri, 22 Jan 2010 01:59:17 +0000
parents 38cfe222e1a4
children 8a4984c5cacc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
10018
46f8d58fbdfb Split RV10 encoder off into its own file.
diego
parents: 10017
diff changeset
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
986e461dc072 Initial revision
glantau
parents:
diff changeset
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
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
718a22dc121f license/copyright change
glantau
parents: 396
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: 3796
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
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
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
429
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
718a22dc121f license/copyright change
glantau
parents: 396
diff changeset
16 * Lesser General Public License for more details.
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 *
429
718a22dc121f license/copyright change
glantau
parents: 396
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: 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
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 */
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1070
diff changeset
22
1e39f273ecd6 per file doxy
michaelni
parents: 1070
diff changeset
23 /**
10018
46f8d58fbdfb Split RV10 encoder off into its own file.
diego
parents: 10017
diff changeset
24 * @file libavcodec/rv10enc.c
46f8d58fbdfb Split RV10 encoder off into its own file.
diego
parents: 10017
diff changeset
25 * RV10 encoder
1106
1e39f273ecd6 per file doxy
michaelni
parents: 1070
diff changeset
26 */
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2848
diff changeset
27
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 #include "mpegvideo.h"
10018
46f8d58fbdfb Split RV10 encoder off into its own file.
diego
parents: 10017
diff changeset
29 #include "put_bits.h"
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
30
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 void rv10_encode_picture_header(MpegEncContext *s, int picture_number)
986e461dc072 Initial revision
glantau
parents:
diff changeset
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
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 align_put_bits(&s->pb);
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2848
diff changeset
36
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
37 put_bits(&s->pb, 1, 1); /* marker */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
38
6481
493dc59d469a add FF_ prefix to all (frame)_TYPE usage
aurel
parents: 6250
diff changeset
39 put_bits(&s->pb, 1, (s->pict_type == FF_P_TYPE));
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
40
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
41 put_bits(&s->pb, 1, 0); /* not PB frame */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
42
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 put_bits(&s->pb, 5, s->qscale);
986e461dc072 Initial revision
glantau
parents:
diff changeset
44
6481
493dc59d469a add FF_ prefix to all (frame)_TYPE usage
aurel
parents: 6250
diff changeset
45 if (s->pict_type == FF_I_TYPE) {
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
46 /* specific MPEG like DC coding not used */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 }
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 /* if multiple packets per frame are sent, the position at which
7980
3b5964de95cd spelling cosmetics
diego
parents: 7782
diff changeset
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
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
51 put_bits(&s->pb, 6, 0); /* mb_x */
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
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
986e461dc072 Initial revision
glantau
parents:
diff changeset
55
2979
bfabfdf9ce55 COSMETICS: tabs --> spaces, some prettyprinting
diego
parents: 2967
diff changeset
56 put_bits(&s->pb, 3, 0); /* ignored */
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 }
1655
c92147a61d97 rv20 (h263) b frame decoding support
michael
parents: 1652
diff changeset
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",
fef7b43f0d22 Move AVCodec declarations for RV10/20 from mpegvideo_enc.c to rv10.c.
diego
parents: 10008
diff changeset
61 CODEC_TYPE_VIDEO,
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 };