Mercurial > libavcodec.hg
annotate chomp_bsf.c @ 12197:fbf4d5b1b664 libavcodec
Remove FF_MM_SSE2/3 flags for CPUs where this is generally not faster than
regular MMX code. Examples of this are the Core1 CPU. Instead, set a new flag,
FF_MM_SSE2/3SLOW, which can be checked for particular SSE2/3 functions that
have been checked specifically on such CPUs and are actually faster than
their MMX counterparts.
In addition, use this flag to enable particular VP8 and LPC SSE2 functions
that are faster than their MMX counterparts.
Based on a patch by Loren Merritt <lorenm AT u washington edu>.
author | rbultje |
---|---|
date | Mon, 19 Jul 2010 22:38:23 +0000 |
parents | 54091478e0c3 |
children |
rev | line source |
---|---|
11747
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
1 /* |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
2 * Chomp bitstream filter |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
3 * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com> |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
4 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
5 * This file is part of FFmpeg. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
6 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
11 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
16 * |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
20 */ |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
21 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
22 #include "avcodec.h" |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
23 #include "internal.h" |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
24 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
25 static int chomp_filter(AVBitStreamFilterContext *bsfc, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
26 AVCodecContext *avctx, const char *args, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
27 uint8_t **poutbuf, int *poutbuf_size, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
28 const uint8_t *buf, int buf_size, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
29 int keyframe) |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
30 { |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
31 while (buf_size > 0 && !buf[buf_size-1]) |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
32 buf_size--; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
33 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
34 *poutbuf = (uint8_t*) buf; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
35 *poutbuf_size = buf_size; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
36 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
37 return 0; |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
38 } |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
39 |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
40 /** |
12073
54091478e0c3
Replace '\0 bytes' by 'NULL bytes' in Doxygen comments.
diego
parents:
11747
diff
changeset
|
41 * This filter removes a string of NULL bytes from the end of a packet. |
11747
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
42 */ |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
43 AVBitStreamFilter chomp_bsf = { |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
44 "chomp", |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
45 0, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
46 chomp_filter, |
3a150ee29655
Add a chomp BSF to consume zero padding at the end of a packet.
alexc
parents:
diff
changeset
|
47 }; |