Browse code

Merge commit '7e244c68600f479270e979258e389ed5240885fb'

* commit '7e244c68600f479270e979258e389ed5240885fb':
avframe: add codec-independent stereoscopic metadata

Conflicts:
Changelog
libavutil/Makefile
libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/12/10 05:33:51
Showing 7 changed files
... ...
@@ -13,6 +13,7 @@ version <next>
13 13
 - remove mp3_header_compress bitstream filters
14 14
 - Windows resource files for shared libraries
15 15
 - aeval filter
16
+- stereoscopic 3d metadata handling
16 17
 
17 18
 
18 19
 version 2.1:
... ...
@@ -21,6 +21,10 @@ API changes, most recent first:
21 21
   Moves version.h to libavutil/ffversion.h.
22 22
   Install ffversion.h and make it public.
23 23
 
24
+2013-11-xx - xxxxxxx- - lavu 52.20.0 - frame.h
25
+  Add AV_FRAME_DATA_STEREO3D value to the AVFrameSideDataType enum and
26
+  stereo3d.h API, that identify codec-independent stereo3d information.
27
+
24 28
 2013-11-xx - xxxxxxx- - lavu 52.19.0 - frame.h
25 29
   Add AV_FRAME_DATA_A53_CC value to the AVFrameSideDataType enum, which
26 30
   identifies ATSC A53 Part 4 Closed Captions data.
... ...
@@ -47,6 +47,7 @@ HEADERS = adler32.h                                                     \
47 47
           samplefmt.h                                                   \
48 48
           sha.h                                                         \
49 49
           sha512.h                                                      \
50
+          stereo3d.h                                                    \
50 51
           time.h                                                        \
51 52
           timecode.h                                                    \
52 53
           timestamp.h                                                   \
... ...
@@ -110,6 +111,7 @@ OBJS = adler32.o                                                        \
110 110
        samplefmt.o                                                      \
111 111
        sha.o                                                            \
112 112
        sha512.o                                                         \
113
+       stereo3d.o                                                       \
113 114
        time.o                                                           \
114 115
        timecode.o                                                       \
115 116
        tree.o                                                           \
... ...
@@ -64,6 +64,11 @@ enum AVFrameSideDataType {
64 64
      * The number of bytes of CC data is AVFrameSideData.size.
65 65
      */
66 66
     AV_FRAME_DATA_A53_CC,
67
+    /**
68
+     * Stereoscopic 3d metadata.
69
+     * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
70
+     */
71
+    AV_FRAME_DATA_STEREO3D,
67 72
 };
68 73
 
69 74
 typedef struct AVFrameSideData {
70 75
new file mode 100644
... ...
@@ -0,0 +1,40 @@
0
+/*
1
+ * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include <stdint.h>
21
+
22
+#include "mem.h"
23
+#include "stereo3d.h"
24
+
25
+AVStereo3D *av_stereo3d_alloc(void)
26
+{
27
+    return av_mallocz(sizeof(AVStereo3D));
28
+}
29
+
30
+AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame)
31
+{
32
+    AVFrameSideData *side_data = av_frame_new_side_data(frame,
33
+                                                        AV_FRAME_DATA_STEREO3D,
34
+                                                        sizeof(AVStereo3D));
35
+    if (!side_data)
36
+        return NULL;
37
+
38
+    return (AVStereo3D *)side_data->data;
39
+}
0 40
new file mode 100644
... ...
@@ -0,0 +1,147 @@
0
+/*
1
+ * Copyright (c) 2013 Vittorio Giovara <vittorio.giovara@gmail.com>
2
+ *
3
+ * This file is part of FFmpeg.
4
+ *
5
+ * FFmpeg is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * FFmpeg is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with FFmpeg; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+#include <stdint.h>
21
+
22
+#include "frame.h"
23
+
24
+/**
25
+ * List of possible 3D Types
26
+ */
27
+enum AVStereo3DType {
28
+    /**
29
+     * Video is not stereoscopic (and metadata has to be there).
30
+     */
31
+    AV_STEREO3D_2D,
32
+
33
+    /**
34
+     * Views are next to each other.
35
+     *
36
+     *    LLLLRRRR
37
+     *    LLLLRRRR
38
+     *    LLLLRRRR
39
+     *    ...
40
+     */
41
+    AV_STEREO3D_SIDEBYSIDE,
42
+
43
+    /**
44
+     * Views are on top of each other.
45
+     *
46
+     *    LLLLLLLL
47
+     *    LLLLLLLL
48
+     *    RRRRRRRR
49
+     *    RRRRRRRR
50
+     */
51
+    AV_STEREO3D_TOPBOTTOM,
52
+
53
+    /**
54
+     * Views are alternated temporally.
55
+     *
56
+     *     frame0   frame1   frame2   ...
57
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
58
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
59
+     *    LLLLLLLL RRRRRRRR LLLLLLLL
60
+     *    ...      ...      ...
61
+     */
62
+    AV_STEREO3D_FRAMESEQUENCE,
63
+
64
+    /**
65
+     * Views are packed in a checkerboard-like structure per pixel.
66
+     *
67
+     *    LRLRLRLR
68
+     *    RLRLRLRL
69
+     *    LRLRLRLR
70
+     *    ...
71
+     */
72
+    AV_STEREO3D_CHECKERBOARD,
73
+
74
+    /**
75
+     * Views are next to each other, but when upscaling
76
+     * apply a checkerboard pattern.
77
+     *
78
+     *     LLLLRRRR          L L L L    R R R R
79
+     *     LLLLRRRR    =>     L L L L  R R R R
80
+     *     LLLLRRRR          L L L L    R R R R
81
+     *     LLLLRRRR           L L L L  R R R R
82
+     */
83
+    AV_STEREO3D_SIDEBYSIDE_QUINCUNX,
84
+
85
+    /**
86
+     * Views are packed per line, as if interlaced.
87
+     *
88
+     *    LLLLLLLL
89
+     *    RRRRRRRR
90
+     *    LLLLLLLL
91
+     *    ...
92
+     */
93
+    AV_STEREO3D_LINES,
94
+
95
+    /**
96
+     * Views are packed per column.
97
+     *
98
+     *    LRLRLRLR
99
+     *    LRLRLRLR
100
+     *    LRLRLRLR
101
+     *    ...
102
+     */
103
+    AV_STEREO3D_COLUMNS,
104
+};
105
+
106
+
107
+/**
108
+ * Inverted views, Right/Bottom represents the left view.
109
+ */
110
+#define AV_STEREO3D_FLAG_INVERT     (1 << 0)
111
+
112
+/**
113
+ * Stereo 3D type: this structure describes how two videos are packed
114
+ * within a single video surface, with additional information as needed.
115
+ *
116
+ * @note The struct must be allocated with av_stereo3d_alloc() and
117
+ *       its size is not a part of the public ABI.
118
+ */
119
+typedef struct AVStereo3D {
120
+    /**
121
+     * How views are packed within the video.
122
+     */
123
+    enum AVStereo3DType type;
124
+
125
+    /**
126
+     * Additional information about the frame packing.
127
+     */
128
+    int flags;
129
+} AVStereo3D;
130
+
131
+/**
132
+ * Allocate an AVStereo3D structure and set its fields to default values.
133
+ * The resulting struct can be freed using av_freep().
134
+ *
135
+ * @return An AVStereo3D filled with default values or NULL on failure.
136
+ */
137
+AVStereo3D *av_stereo3d_alloc(void);
138
+
139
+/**
140
+ * Allocate a complete AVFrameSideData and add it to the frame.
141
+ *
142
+ * @param The frame on which the side data is added to.
143
+ *
144
+ * @return The AVStereo3D structure to be filled by caller.
145
+ */
146
+AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame);
... ...
@@ -75,7 +75,7 @@
75 75
  */
76 76
 
77 77
 #define LIBAVUTIL_VERSION_MAJOR  52
78
-#define LIBAVUTIL_VERSION_MINOR  57
78
+#define LIBAVUTIL_VERSION_MINOR  58
79 79
 #define LIBAVUTIL_VERSION_MICRO 100
80 80
 
81 81
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \