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

Side by Side Diff: source/libvpx/vpx/internal/vpx_codec_internal.h

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/vp9/vp9cx.mk ('k') | source/libvpx/vpx/src/svc_encodeframe.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 * \note 241 * \note
242 * When decoding VP9, the application may be required to pass in at least 242 * When decoding VP9, the application may be required to pass in at least
243 * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame 243 * #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS external frame
244 * buffers. 244 * buffers.
245 */ 245 */
246 typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)( 246 typedef vpx_codec_err_t (*vpx_codec_set_fb_fn_t)(
247 vpx_codec_alg_priv_t *ctx, 247 vpx_codec_alg_priv_t *ctx,
248 vpx_get_frame_buffer_cb_fn_t cb_get, 248 vpx_get_frame_buffer_cb_fn_t cb_get,
249 vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv); 249 vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv);
250 250
251 /*\brief eXternal Memory Allocation memory map get iterator
252 *
253 * Iterates over a list of the memory maps requested by the decoder. The
254 * iterator storage should be initialized to NULL to start the iteration.
255 * Iteration is complete when this function returns NULL.
256 *
257 * \param[in out] iter Iterator storage, initialized to NULL
258 *
259 * \return Returns a pointer to an memory segment descriptor, or NULL to
260 * indicate end-of-list.
261 */
262 typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *c tx,
263 vpx_codec_mmap_t *m map,
264 vpx_codec_iter_t *i ter);
265
266
267 /*\brief eXternal Memory Allocation memory map set iterator
268 *
269 * Sets a memory descriptor inside the decoder instance.
270 *
271 * \param[in] ctx Pointer to this instance's context
272 * \param[in] mmap Memory map to store.
273 *
274 * \retval #VPX_CODEC_OK
275 * The memory map was accepted and stored.
276 * \retval #VPX_CODEC_MEM_ERROR
277 * The memory map was rejected.
278 */
279 typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
280 const vpx_codec_mmap_t *mmap );
281
282 251
283 typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx, 252 typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
284 const vpx_image_t *img, 253 const vpx_image_t *img,
285 vpx_codec_pts_t pts, 254 vpx_codec_pts_t pts,
286 unsigned long duration , 255 unsigned long duration ,
287 vpx_enc_frame_flags_t flags, 256 vpx_enc_frame_flags_t flags,
288 unsigned long deadline ); 257 unsigned long deadline );
289 typedef const vpx_codec_cx_pkt_t *(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_pr iv_t *ctx, 258 typedef const vpx_codec_cx_pkt_t *(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_pr iv_t *ctx,
290 vpx_codec_iter_t *iter); 259 vpx_codec_iter_t *iter);
291 260
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 * 292 *
324 * All decoders \ref MUST expose a variable of this type. 293 * All decoders \ref MUST expose a variable of this type.
325 */ 294 */
326 struct vpx_codec_iface { 295 struct vpx_codec_iface {
327 const char *name; /**< Identification String */ 296 const char *name; /**< Identification String */
328 int abi_version; /**< Implemented ABI version */ 297 int abi_version; /**< Implemented ABI version */
329 vpx_codec_caps_t caps; /**< Decoder capabilities */ 298 vpx_codec_caps_t caps; /**< Decoder capabilities */
330 vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */ 299 vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
331 vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */ 300 vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
332 vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */ 301 vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
333 vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
334 vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
335 struct vpx_codec_dec_iface { 302 struct vpx_codec_dec_iface {
336 vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_ t */ 303 vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_ t */
337 vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_get_si_fn_t */ 304 vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_get_si_fn_t */
338 vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */ 305 vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
339 vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_f n_t */ 306 vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_f n_t */
340 vpx_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::vpx_codec_set_fb_fn_t */ 307 vpx_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::vpx_codec_set_fb_fn_t */
341 } dec; 308 } dec;
342 struct vpx_codec_enc_iface { 309 struct vpx_codec_enc_iface {
310 int cfg_map_count;
343 vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_ enc_cfg_map_t */ 311 vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_ enc_cfg_map_t */
344 vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_ encode_fn_t */ 312 vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_ encode_fn_t */
345 vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_ get_cx_data_fn_t */ 313 vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_ get_cx_data_fn_t */
346 vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_ enc_config_set_fn_t */ 314 vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_ enc_config_set_fn_t */
347 vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_ get_global_headers_fn_t */ 315 vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_ get_global_headers_fn_t */
348 vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_ get_preview_frame_fn_t */ 316 vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_ get_preview_frame_fn_t */
349 vpx_codec_enc_mr_get_mem_loc_fn_t mr_get_mem_loc; /**< \copydoc ::vpx_cod ec_enc_mr_get_mem_loc_fn_t */ 317 vpx_codec_enc_mr_get_mem_loc_fn_t mr_get_mem_loc; /**< \copydoc ::vpx_cod ec_enc_mr_get_mem_loc_fn_t */
350 } enc; 318 } enc;
351 }; 319 };
352 320
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 struct vpx_codec_priv_enc_mr_cfg 362 struct vpx_codec_priv_enc_mr_cfg
395 { 363 {
396 unsigned int mr_total_resolutions; 364 unsigned int mr_total_resolutions;
397 unsigned int mr_encoder_id; 365 unsigned int mr_encoder_id;
398 struct vpx_rational mr_down_sampling_factor; 366 struct vpx_rational mr_down_sampling_factor;
399 void* mr_low_res_mode_info; 367 void* mr_low_res_mode_info;
400 }; 368 };
401 369
402 #undef VPX_CTRL_USE_TYPE 370 #undef VPX_CTRL_USE_TYPE
403 #define VPX_CTRL_USE_TYPE(id, typ) \ 371 #define VPX_CTRL_USE_TYPE(id, typ) \
404 static typ id##__value(va_list args) {return va_arg(args, typ);} \ 372 static VPX_INLINE typ id##__value(va_list args) {return va_arg(args, typ);}
405 373
406 #undef VPX_CTRL_USE_TYPE_DEPRECATED 374 #undef VPX_CTRL_USE_TYPE_DEPRECATED
407 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \ 375 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
408 static typ id##__value(va_list args) {return va_arg(args, typ);} \ 376 static VPX_INLINE typ id##__value(va_list args) {return va_arg(args, typ);}
409 377
410 #define CAST(id, arg) id##__value(arg) 378 #define CAST(id, arg) id##__value(arg)
411 379
412 /* CODEC_INTERFACE convenience macro 380 /* CODEC_INTERFACE convenience macro
413 * 381 *
414 * By convention, each codec interface is a struct with extern linkage, where 382 * By convention, each codec interface is a struct with extern linkage, where
415 * the symbol is suffixed with _algo. A getter function is also defined to 383 * the symbol is suffixed with _algo. A getter function is also defined to
416 * return a pointer to the struct, since in some cases it's easier to work 384 * return a pointer to the struct, since in some cases it's easier to work
417 * with text symbols than data symbols (see issue #169). This function has 385 * with text symbols than data symbols (see issue #169). This function has
418 * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE 386 * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 #include <setjmp.h> 424 #include <setjmp.h>
457 425
458 struct vpx_internal_error_info { 426 struct vpx_internal_error_info {
459 vpx_codec_err_t error_code; 427 vpx_codec_err_t error_code;
460 int has_detail; 428 int has_detail;
461 char detail[80]; 429 char detail[80];
462 int setjmp; 430 int setjmp;
463 jmp_buf jmp; 431 jmp_buf jmp;
464 }; 432 };
465 433
466 static void vpx_internal_error(struct vpx_internal_error_info *info, 434 void vpx_internal_error(struct vpx_internal_error_info *info,
467 vpx_codec_err_t error, 435 vpx_codec_err_t error,
468 const char *fmt, 436 const char *fmt,
469 ...) { 437 ...);
470 va_list ap;
471 438
472 info->error_code = error;
473 info->has_detail = 0;
474
475 if (fmt) {
476 size_t sz = sizeof(info->detail);
477
478 info->has_detail = 1;
479 va_start(ap, fmt);
480 vsnprintf(info->detail, sz - 1, fmt, ap);
481 va_end(ap);
482 info->detail[sz - 1] = '\0';
483 }
484
485 if (info->setjmp)
486 longjmp(info->jmp, info->error_code);
487 }
488
489 //------------------------------------------------------------------------------
490 // mmap interface
491
492 typedef struct {
493 unsigned int id;
494 unsigned long sz;
495 unsigned int align;
496 unsigned int flags;
497 unsigned long (*calc_sz)(const vpx_codec_dec_cfg_t *, vpx_codec_flags_t);
498 } mem_req_t;
499
500 // Allocates mmap.priv and sets mmap.base based on mmap.sz/align/flags
501 // requirements.
502 // Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
503 vpx_codec_err_t vpx_mmap_alloc(vpx_codec_mmap_t *mmap);
504
505 // Frees mmap.base allocated by a call to vpx_mmap_alloc().
506 void vpx_mmap_dtor(vpx_codec_mmap_t *mmap);
507
508 // Checks each mmap has the size requirement specificied by mem_reqs.
509 // Returns #VPX_CODEC_OK on success, #VPX_CODEC_MEM_ERROR otherwise.
510 vpx_codec_err_t vpx_validate_mmaps(const vpx_codec_stream_info_t *si,
511 const vpx_codec_mmap_t *mmaps,
512 const mem_req_t *mem_reqs, int nreqs,
513 vpx_codec_flags_t init_flags);
514 #ifdef __cplusplus 439 #ifdef __cplusplus
515 } // extern "C" 440 } // extern "C"
516 #endif 441 #endif
517 442
518 #endif // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_ 443 #endif // VPX_INTERNAL_VPX_CODEC_INTERNAL_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp9/vp9cx.mk ('k') | source/libvpx/vpx/src/svc_encodeframe.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698