usage_dx.dox 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*! \page usage_decode Decoding
  2. The vpx_codec_decode() function is at the core of the decode loop. It
  3. processes packets of compressed data passed by the application, producing
  4. decoded images. The decoder expects packets to comprise exactly one image
  5. frame of data. Packets \ref MUST be passed in decode order. If the
  6. application wishes to associate some data with the frame, the
  7. <code>user_priv</code> member may be set. The <code>deadline</code>
  8. parameter controls the amount of time in microseconds the decoder should
  9. spend working on the frame. This is typically used to support adaptive
  10. \ref usage_postproc based on the amount of free CPU time. For more
  11. information on the <code>deadline</code> parameter, see \ref usage_deadline.
  12. \if samples
  13. \ref samples
  14. \endif
  15. \section usage_cb Callback Based Decoding
  16. There are two methods for the application to access decoded frame data. Some
  17. codecs support asynchronous (callback-based) decoding \ref usage_features
  18. that allow the application to register a callback to be invoked by the
  19. decoder when decoded data becomes available. Decoders are not required to
  20. support this feature, however. Like all \ref usage_features, support can be
  21. determined by calling vpx_codec_get_caps(). Callbacks are available in both
  22. frame-based and slice-based variants. Frame based callbacks conform to the
  23. signature of #vpx_codec_put_frame_cb_fn_t and are invoked once the entire
  24. frame has been decoded. Slice based callbacks conform to the signature of
  25. #vpx_codec_put_slice_cb_fn_t and are invoked after a subsection of the frame
  26. is decoded. For example, a slice callback could be issued for each
  27. macroblock row. However, the number and size of slices to return is
  28. implementation specific. Also, the image data passed in a slice callback is
  29. not necessarily in the same memory segment as the data will be when it is
  30. assembled into a full frame. For this reason, the application \ref MUST
  31. examine the rectangles that describe what data is valid to access and what
  32. data has been updated in this call. For all their additional complexity,
  33. slice based decoding callbacks provide substantial speed gains to the
  34. overall application in some cases, due to improved cache behavior.
  35. \section usage_frame_iter Frame Iterator Based Decoding
  36. If the codec does not support callback based decoding, or the application
  37. chooses not to make use of that feature, decoded frames are made available
  38. through the vpx_codec_get_frame() iterator. The application initializes the
  39. iterator storage (of type #vpx_codec_iter_t) to NULL, then calls
  40. vpx_codec_get_frame repeatedly until it returns NULL, indicating that all
  41. images have been returned. This process may result in zero, one, or many
  42. frames that are ready for display, depending on the codec.
  43. \section usage_postproc Postprocessing
  44. Postprocessing is a process that is applied after a frame is decoded to
  45. enhance the image's appearance by removing artifacts introduced in the
  46. compression process. It is not required to properly decode the frame, and
  47. is generally done only when there is enough spare CPU time to execute
  48. the required filters. Codecs may support a number of different
  49. postprocessing filters, and the available filters may differ from platform
  50. to platform. Embedded devices often do not have enough CPU to implement
  51. postprocessing in software. The filter selection is generally handled
  52. automatically by the codec, depending on the amount of time remaining before
  53. hitting the user-specified \ref usage_deadline after decoding the frame.
  54. */