* commit '4d55e9de27894ddfb337b28cd7aa6d14a12666d2':
vc1: Split bits used in libavformat into a separate header
Conflicts:
libavformat/movenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -27,35 +27,11 @@ |
27 | 27 |
#include "h264chroma.h" |
28 | 28 |
#include "mpegvideo.h" |
29 | 29 |
#include "intrax8.h" |
30 |
+#include "vc1_common.h" |
|
30 | 31 |
#include "vc1dsp.h" |
31 | 32 |
|
32 | 33 |
#define AC_VLC_BITS 9 |
33 | 34 |
|
34 |
-/** Markers used in VC-1 AP frame data */ |
|
35 |
-//@{ |
|
36 |
-enum VC1Code { |
|
37 |
- VC1_CODE_RES0 = 0x00000100, |
|
38 |
- VC1_CODE_ENDOFSEQ = 0x0000010A, |
|
39 |
- VC1_CODE_SLICE, |
|
40 |
- VC1_CODE_FIELD, |
|
41 |
- VC1_CODE_FRAME, |
|
42 |
- VC1_CODE_ENTRYPOINT, |
|
43 |
- VC1_CODE_SEQHDR, |
|
44 |
-}; |
|
45 |
-//@} |
|
46 |
- |
|
47 |
-#define IS_MARKER(x) (((x) & ~0xFF) == VC1_CODE_RES0) |
|
48 |
- |
|
49 |
-/** Available Profiles */ |
|
50 |
-//@{ |
|
51 |
-enum Profile { |
|
52 |
- PROFILE_SIMPLE, |
|
53 |
- PROFILE_MAIN, |
|
54 |
- PROFILE_COMPLEX, ///< TODO: WMV9 specific |
|
55 |
- PROFILE_ADVANCED |
|
56 |
-}; |
|
57 |
-//@} |
|
58 |
- |
|
59 | 35 |
/** Sequence quantizer mode */ |
60 | 36 |
//@{ |
61 | 37 |
enum QuantMode { |
... | ... |
@@ -417,43 +393,6 @@ typedef struct VC1Context{ |
417 | 417 |
int resync_marker; ///< could this stream contain resync markers |
418 | 418 |
} VC1Context; |
419 | 419 |
|
420 |
-/** Find VC-1 marker in buffer |
|
421 |
- * @return position where next marker starts or end of buffer if no marker found |
|
422 |
- */ |
|
423 |
-static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end) |
|
424 |
-{ |
|
425 |
- uint32_t mrk = 0xFFFFFFFF; |
|
426 |
- |
|
427 |
- if (end-src < 4) |
|
428 |
- return end; |
|
429 |
- while (src < end) { |
|
430 |
- mrk = (mrk << 8) | *src++; |
|
431 |
- if (IS_MARKER(mrk)) |
|
432 |
- return src - 4; |
|
433 |
- } |
|
434 |
- return end; |
|
435 |
-} |
|
436 |
- |
|
437 |
-static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, uint8_t *dst) |
|
438 |
-{ |
|
439 |
- int dsize = 0, i; |
|
440 |
- |
|
441 |
- if (size < 4) { |
|
442 |
- for (dsize = 0; dsize < size; dsize++) |
|
443 |
- *dst++ = *src++; |
|
444 |
- return size; |
|
445 |
- } |
|
446 |
- for (i = 0; i < size; i++, src++) { |
|
447 |
- if (src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { |
|
448 |
- dst[dsize++] = src[1]; |
|
449 |
- src++; |
|
450 |
- i++; |
|
451 |
- } else |
|
452 |
- dst[dsize++] = *src; |
|
453 |
- } |
|
454 |
- return dsize; |
|
455 |
-} |
|
456 |
- |
|
457 | 420 |
/** |
458 | 421 |
* Decode Simple/Main Profiles sequence header |
459 | 422 |
* @see Figure 7-8, p16-17 |
460 | 423 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,92 @@ |
0 |
+/* |
|
1 |
+ * VC-1 and WMV3 decoder |
|
2 |
+ * Copyright (c) 2006-2007 Konstantin Shishkov |
|
3 |
+ * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer |
|
4 |
+ * |
|
5 |
+ * This file is part of FFmpeg. |
|
6 |
+ * |
|
7 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
8 |
+ * modify it under the terms of the GNU Lesser General Public |
|
9 |
+ * License as published by the Free Software Foundation; either |
|
10 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
11 |
+ * |
|
12 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
13 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
+ * Lesser General Public License for more details. |
|
16 |
+ * |
|
17 |
+ * You should have received a copy of the GNU Lesser General Public |
|
18 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
19 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+#ifndef AVCODEC_VC1_COMMON_H |
|
23 |
+#define AVCODEC_VC1_COMMON_H |
|
24 |
+ |
|
25 |
+#include <stdint.h> |
|
26 |
+ |
|
27 |
+#include "libavutil/attributes.h" |
|
28 |
+ |
|
29 |
+/** Markers used in VC-1 AP frame data */ |
|
30 |
+//@{ |
|
31 |
+enum VC1Code { |
|
32 |
+ VC1_CODE_RES0 = 0x00000100, |
|
33 |
+ VC1_CODE_ENDOFSEQ = 0x0000010A, |
|
34 |
+ VC1_CODE_SLICE, |
|
35 |
+ VC1_CODE_FIELD, |
|
36 |
+ VC1_CODE_FRAME, |
|
37 |
+ VC1_CODE_ENTRYPOINT, |
|
38 |
+ VC1_CODE_SEQHDR, |
|
39 |
+}; |
|
40 |
+//@} |
|
41 |
+ |
|
42 |
+#define IS_MARKER(x) (((x) & ~0xFF) == VC1_CODE_RES0) |
|
43 |
+ |
|
44 |
+/** Available Profiles */ |
|
45 |
+//@{ |
|
46 |
+enum Profile { |
|
47 |
+ PROFILE_SIMPLE, |
|
48 |
+ PROFILE_MAIN, |
|
49 |
+ PROFILE_COMPLEX, ///< TODO: WMV9 specific |
|
50 |
+ PROFILE_ADVANCED |
|
51 |
+}; |
|
52 |
+//@} |
|
53 |
+ |
|
54 |
+/** Find VC-1 marker in buffer |
|
55 |
+ * @return position where next marker starts or end of buffer if no marker found |
|
56 |
+ */ |
|
57 |
+static av_always_inline const uint8_t* find_next_marker(const uint8_t *src, const uint8_t *end) |
|
58 |
+{ |
|
59 |
+ uint32_t mrk = 0xFFFFFFFF; |
|
60 |
+ |
|
61 |
+ if (end-src < 4) |
|
62 |
+ return end; |
|
63 |
+ while (src < end) { |
|
64 |
+ mrk = (mrk << 8) | *src++; |
|
65 |
+ if (IS_MARKER(mrk)) |
|
66 |
+ return src - 4; |
|
67 |
+ } |
|
68 |
+ return end; |
|
69 |
+} |
|
70 |
+ |
|
71 |
+static av_always_inline int vc1_unescape_buffer(const uint8_t *src, int size, uint8_t *dst) |
|
72 |
+{ |
|
73 |
+ int dsize = 0, i; |
|
74 |
+ |
|
75 |
+ if (size < 4) { |
|
76 |
+ for (dsize = 0; dsize < size; dsize++) |
|
77 |
+ *dst++ = *src++; |
|
78 |
+ return size; |
|
79 |
+ } |
|
80 |
+ for (i = 0; i < size; i++, src++) { |
|
81 |
+ if (src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) { |
|
82 |
+ dst[dsize++] = src[1]; |
|
83 |
+ src++; |
|
84 |
+ i++; |
|
85 |
+ } else |
|
86 |
+ dst[dsize++] = *src; |
|
87 |
+ } |
|
88 |
+ return dsize; |
|
89 |
+} |
|
90 |
+ |
|
91 |
+#endif /* AVCODEC_VC1_COMMON_H */ |
... | ... |
@@ -33,7 +33,7 @@ |
33 | 33 |
#include "avc.h" |
34 | 34 |
#include "libavcodec/get_bits.h" |
35 | 35 |
#include "libavcodec/put_bits.h" |
36 |
-#include "libavcodec/vc1.h" |
|
36 |
+#include "libavcodec/vc1_common.h" |
|
37 | 37 |
#include "libavcodec/raw.h" |
38 | 38 |
#include "internal.h" |
39 | 39 |
#include "libavutil/avstring.h" |
... | ... |
@@ -42,6 +42,7 @@ |
42 | 42 |
#include "libavutil/opt.h" |
43 | 43 |
#include "libavutil/dict.h" |
44 | 44 |
#include "libavutil/pixdesc.h" |
45 |
+#include "libavutil/timecode.h" |
|
45 | 46 |
#include "hevc.h" |
46 | 47 |
#include "rtpenc.h" |
47 | 48 |
#include "mov_chan.h" |