Re: [FFmpeg-devel] [PATCH] mem: Extend and edit Doxygen

2016-08-21 Thread Timothy Gu
On Fri Aug 5 14:15:19 EEST 2016, Michael Niedermayer wrote:
> to me it sounds more natural without "the" but english aint my area

Changed.

> either way the patch overall looks nice (i didnt deeply review)
> Acked-by: Michael

Thanks. Pushed.

Timothy
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] mem: Extend and edit Doxygen

2016-08-05 Thread Michael Niedermayer
On Tue, Aug 02, 2016 at 10:22:21AM -0700, Timothy Gu wrote:
> ---
> 
> A bit more editing...
> 
> ---
>  libavutil/mem.h | 588 
> +++-
>  1 file changed, 451 insertions(+), 137 deletions(-)
> 
> diff --git a/libavutil/mem.h b/libavutil/mem.h
> index 145ac91..4b99342 100644
> --- a/libavutil/mem.h
> +++ b/libavutil/mem.h
> @@ -20,7 +20,8 @@
>  
>  /**
>   * @file
> - * memory handling functions
> + * @ingroup lavu_mem
> + * Memory handling functions
>   */
>  
>  #ifndef AVUTIL_MEM_H
> @@ -35,9 +36,56 @@
>  
>  /**
>   * @addtogroup lavu_mem
> + * Utilities for manipulating memory.
> + *
> + * FFmpeg has several applications of memory that are not required of a 
> typical
> + * program. For example, the computing-heavy components like video decoding 
> and
> + * encoding can be sped up significantly through the use of aligned memory.
> + *
> + * However, for each of FFmpeg's applications of memory, there might not be a
> + * recognized or standardized API for that specific use. Memory alignment, 
> for
> + * instance, varies wildly depending on operating systems, architectures, and
> + * compilers. Hence, this component of @ref libavutil is created to make
> + * dealing with memory consistently possible on all platforms.
> + *
> + * @{
> + *
> + * @defgroup lavu_mem_macros Alignment Macros
> + * Helper macros for declaring aligned variables.
>   * @{
>   */
>  
> +/**
> + * @def DECLARE_ALIGNED(n,t,v)
> + * Declare a variable that is aligned in the memory.

to me it sounds more natural without "the" but english aint my area

either way the patch overall looks nice (i didnt deeply review)
Acked-by: Michael

Thanks

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] mem: Extend and edit Doxygen

2016-08-02 Thread Timothy Gu
---

A bit more editing...

---
 libavutil/mem.h | 588 +++-
 1 file changed, 451 insertions(+), 137 deletions(-)

diff --git a/libavutil/mem.h b/libavutil/mem.h
index 145ac91..4b99342 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -20,7 +20,8 @@
 
 /**
  * @file
- * memory handling functions
+ * @ingroup lavu_mem
+ * Memory handling functions
  */
 
 #ifndef AVUTIL_MEM_H
@@ -35,9 +36,56 @@
 
 /**
  * @addtogroup lavu_mem
+ * Utilities for manipulating memory.
+ *
+ * FFmpeg has several applications of memory that are not required of a typical
+ * program. For example, the computing-heavy components like video decoding and
+ * encoding can be sped up significantly through the use of aligned memory.
+ *
+ * However, for each of FFmpeg's applications of memory, there might not be a
+ * recognized or standardized API for that specific use. Memory alignment, for
+ * instance, varies wildly depending on operating systems, architectures, and
+ * compilers. Hence, this component of @ref libavutil is created to make
+ * dealing with memory consistently possible on all platforms.
+ *
+ * @{
+ *
+ * @defgroup lavu_mem_macros Alignment Macros
+ * Helper macros for declaring aligned variables.
  * @{
  */
 
+/**
+ * @def DECLARE_ALIGNED(n,t,v)
+ * Declare a variable that is aligned in the memory.
+ *
+ * @code{.c}
+ * DECLARE_ALIGNED(16, uint16_t, aligned_int) = 42;
+ * DECLARE_ALIGNED(32, uint8_t, aligned_array)[128];
+ *
+ * // The default-alignment equivalent would be
+ * uint16_t aligned_int = 42;
+ * uint8_t aligned_array[128];
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
+
+/**
+ * @def DECLARE_ASM_CONST(n,t,v)
+ * Declare a static constant aligned variable appropriate for use in inline
+ * assembly code.
+ *
+ * @code{.c}
+ * DECLARE_ASM_CONST(16, uint64_t, pw_08) = UINT64_C(0x0008000800080008);
+ * @endcode
+ *
+ * @param n Minimum alignment in bytes
+ * @param t Type of the variable (or array element)
+ * @param v Name of the variable
+ */
 
 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
 #define DECLARE_ALIGNED(n,t,v)  t __attribute__ ((aligned (n))) v
@@ -60,12 +108,47 @@
 #define DECLARE_ASM_CONST(n,t,v)static const t v
 #endif
 
+/**
+ * @}
+ */
+
+/**
+ * @defgroup lavu_mem_attrs Function Attributes
+ * Function attributes applicable to memory handling functions.
+ *
+ * These function attributes can help compilers emit more useful warnings, or
+ * generate better code.
+ * @{
+ */
+
+/**
+ * @def av_malloc_attrib
+ * Function attribute denoting a malloc-like function.
+ *
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007bmalloc_007d-function-attribute-3251;>Function
 attribute `malloc` in GCC's documentation
+ */
+
 #if AV_GCC_VERSION_AT_LEAST(3,1)
 #define av_malloc_attrib __attribute__((__malloc__))
 #else
 #define av_malloc_attrib
 #endif
 
+/**
+ * @def av_alloc_size(...)
+ * Function attribute used on a function that allocates memory, whose size is
+ * given by the specified parameter(s).
+ *
+ * @code{.c}
+ * void *av_malloc(size_t size) av_alloc_size(1);
+ * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2);
+ * @endcode
+ *
+ * @param ... One or two parameter indexes, separated by a comma
+ *
+ * @see https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-g_t_0040code_007balloc_005fsize_007d-function-attribute-3220;>Function
 attribute `alloc_size` in GCC's documentation
+ */
+
 #if AV_GCC_VERSION_AT_LEAST(4,3)
 #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
 #else
@@ -73,31 +156,51 @@
 #endif
 
 /**
- * Allocate a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU).
- * @param size Size in bytes for the memory block to be allocated.
- * @return Pointer to the allocated block, NULL if the block cannot
- * be allocated.
+ * @}
+ */
+
+/**
+ * @defgroup lavu_mem_funcs Heap Management
+ * Functions responsible for allocating, freeing, and copying memory.
+ *
+ * All memory allocation functions have a built-in upper limit of `INT_MAX`
+ * bytes. This may be changed with av_max_alloc(), although exercise extreme
+ * caution when doing so.
+ *
+ * @{
+ */
+
+/**
+ * Allocate a memory block with alignment suitable for all memory accesses
+ * (including vectors if available on the CPU).
+ *
+ * @param size Size in bytes for the memory block to be allocated
+ * @return Pointer to the allocated block, or `NULL` if the block cannot
+ * be allocated
  * @see av_mallocz()
  */
 void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
 
 /**
- * Allocate a block of size bytes with alignment suitable for all
- * memory accesses (including vectors if available on the CPU) and
- * zero all the bytes of the block.
-