Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: source/libvpx/usage.dox

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/tools_common.c ('k') | source/libvpx/vp8/common/onyx.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /*!\page usage Usage 1 /*!\page usage Usage
2 2
3 The vpx multi-format codec SDK provides a unified interface amongst its 3 The vpx multi-format codec SDK provides a unified interface amongst its
4 supported codecs. This abstraction allows applications using this SDK to 4 supported codecs. This abstraction allows applications using this SDK to
5 easily support multiple video formats with minimal code duplication or 5 easily support multiple video formats with minimal code duplication or
6 "special casing." This section describes the interface common to all codecs. 6 "special casing." This section describes the interface common to all codecs.
7 For codec-specific details, see the \ref codecs page. 7 For codec-specific details, see the \ref codecs page.
8 8
9 The following sections are common to all codecs: 9 The following sections are common to all codecs:
10 - \ref usage_types 10 - \ref usage_types
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 \section usage_features Features 51 \section usage_features Features
52 Several "features" are defined that are optionally implemented by codec 52 Several "features" are defined that are optionally implemented by codec
53 algorithms. Indeed, the same algorithm may support different features on 53 algorithms. Indeed, the same algorithm may support different features on
54 different platforms. The purpose of defining these features is that when 54 different platforms. The purpose of defining these features is that when
55 they are implemented, they conform to a common interface. The features, or 55 they are implemented, they conform to a common interface. The features, or
56 capabilities, of an algorithm can be queried from it's interface by using 56 capabilities, of an algorithm can be queried from it's interface by using
57 the vpx_codec_get_caps() method. Attempts to invoke features not supported 57 the vpx_codec_get_caps() method. Attempts to invoke features not supported
58 by an algorithm will generally result in #VPX_CODEC_INCAPABLE. 58 by an algorithm will generally result in #VPX_CODEC_INCAPABLE.
59 59
60 Currently defined features available in both encoders and decoders include:
61 - \subpage usage_xma
62
63 \if decoder 60 \if decoder
64 Currently defined decoder features include: 61 Currently defined decoder features include:
65 - \ref usage_cb 62 - \ref usage_cb
66 - \ref usage_postproc 63 - \ref usage_postproc
67 \endif 64 \endif
68 65
69 \section usage_init Initialization 66 \section usage_init Initialization
70 To initialize a codec instance, the address of the codec context 67 To initialize a codec instance, the address of the codec context
71 and interface structures are passed to an initialization function. Depending 68 and interface structures are passed to an initialization function. Depending
72 on the \ref usage_features that the codec supports, the codec could be 69 on the \ref usage_features that the codec supports, the codec could be
73 initialized in different modes. Most notably, the application may choose to 70 initialized in different modes.
74 use \ref usage_xma mode to gain fine grained control over how and where
75 memory is allocated for the codec.
76 71
77 To prevent cases of confusion where the ABI of the library changes, 72 To prevent cases of confusion where the ABI of the library changes,
78 the ABI is versioned. The ABI version number must be passed at 73 the ABI is versioned. The ABI version number must be passed at
79 initialization time to ensure the application is using a header file that 74 initialization time to ensure the application is using a header file that
80 matches the library. The current ABI version number is stored in the 75 matches the library. The current ABI version number is stored in the
81 preprocessor macros #VPX_CODEC_ABI_VERSION, #VPX_ENCODER_ABI_VERSION, and 76 preprocessor macros #VPX_CODEC_ABI_VERSION, #VPX_ENCODER_ABI_VERSION, and
82 #VPX_DECODER_ABI_VERSION. For convenience, each initialization function has 77 #VPX_DECODER_ABI_VERSION. For convenience, each initialization function has
83 a wrapper macro that inserts the correct version number. These macros are 78 a wrapper macro that inserts the correct version number. These macros are
84 named like the initialization methods, but without the _ver suffix. 79 named like the initialization methods, but without the _ver suffix.
85 80
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 and the semantics of the call are preserved, as before. 124 and the semantics of the call are preserved, as before.
130 125
131 The special value <code>0</code> is reserved to represent an infinite 126 The special value <code>0</code> is reserved to represent an infinite
132 deadline. In this case, the codec will perform as much processing as 127 deadline. In this case, the codec will perform as much processing as
133 possible to yield the highest quality frame. 128 possible to yield the highest quality frame.
134 129
135 By convention, the value <code>1</code> is used to mean "return as fast as 130 By convention, the value <code>1</code> is used to mean "return as fast as
136 possible." 131 possible."
137 132
138 */ 133 */
139
140
141 /*! \page usage_xma External Memory Allocation
142 Applications that wish to have fine grained control over how and where
143 decoders allocate memory \ref MAY make use of the eXternal Memory Allocation
144 (XMA) interface. Not all codecs support the XMA \ref usage_features.
145
146 To use a decoder in XMA mode, the decoder \ref MUST be initialized with the
147 vpx_codec_xma_init_ver() function. The amount of memory a decoder needs to
148 allocate is heavily dependent on the size of the encoded video frames. The
149 size of the video must be known before requesting the decoder's memory map.
150 This stream information can be obtained with the vpx_codec_peek_stream_info( )
151 function, which does not require a constructed decoder context. If the exact
152 stream is not known, a stream info structure can be created that reflects
153 the maximum size that the decoder instance is required to support.
154
155 Once the decoder instance has been initialized and the stream information
156 determined, the application calls the vpx_codec_get_mem_map() iterator
157 repeatedly to get a list of the memory segments requested by the decoder.
158 The iterator value should be initialized to NULL to request the first
159 element, and the function will return #VPX_CODEC_LIST_END to signal the end of
160 the list.
161
162 After each segment is identified, it must be passed to the codec through the
163 vpx_codec_set_mem_map() function. Segments \ref MUST be passed in the same
164 order as they are returned from vpx_codec_get_mem_map(), but there is no
165 requirement that vpx_codec_get_mem_map() must finish iterating before
166 vpx_codec_set_mem_map() is called. For instance, some applications may choos e
167 to get a list of all requests, construct an optimal heap, and then set all
168 maps at once with one call. Other applications may set one map at a time,
169 allocating it immediately after it is returned from vpx_codec_get_mem_map().
170
171 After all segments have been set using vpx_codec_set_mem_map(), the codec ma y
172 be used as it would be in normal internal allocation mode.
173
174 \section usage_xma_seg_id Segment Identifiers
175 Each requested segment is identified by an identifier unique to
176 that decoder type. Some of these identifiers are private, while others are
177 enumerated for application use. Identifiers not enumerated publicly are
178 subject to change. Identifiers are non-consecutive.
179
180 \section usage_xma_seg_szalign Segment Size and Alignment
181 The sz (size) and align (alignment) parameters describe the required size
182 and alignment of the requested segment. Alignment will always be a power of
183 two. Applications \ref MUST honor the alignment requested. Failure to do so
184 could result in program crashes or may incur a speed penalty.
185
186 \section usage_xma_seg_flags Segment Flags
187 The flags member of the segment structure indicates any requirements or
188 desires of the codec for the particular segment. The #VPX_CODEC_MEM_ZERO fla g
189 indicates that the segment \ref MUST be zeroed by the application prior to
190 passing it to the application. The #VPX_CODEC_MEM_WRONLY flag indicates that
191 the segment will only be written into by the decoder, not read. If this flag
192 is not set, the application \ref MUST insure that the memory segment is
193 readable. On some platforms, framebuffer memory is writable but not
194 readable, for example. The #VPX_CODEC_MEM_FAST flag indicates that the segme nt
195 will be frequently accessed, and that it should be placed into fast memory,
196 if any is available. The application \ref MAY choose to place other segments
197 in fast memory as well, but the most critical segments will be identified by
198 this flag.
199
200 \section usage_xma_seg_basedtor Segment Base Address and Destructor
201 For each requested memory segment, the application must determine the
202 address of a memory segment that meets the requirements of the codec. This
203 address is set in the <code>base</code> member of the #vpx_codec_mmap
204 structure. If the application requires processing when the segment is no
205 longer used by the codec (for instance to deallocate it or close an
206 associated file descriptor) the <code>dtor</code> and <code>priv</code>
207 members can be set.
208 */
OLDNEW
« no previous file with comments | « source/libvpx/tools_common.c ('k') | source/libvpx/vp8/common/onyx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698