[FFmpeg-devel,1/2] avutil: export av_memset_bytes()

Submitted by Michael Niedermayer on Dec. 28, 2018, 7:26 p.m.

Details

Message ID 20181228192658.16628-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer Dec. 28, 2018, 7:26 p.m.
This function is useful in more cases than just imgutils

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 doc/APIchanges       |  3 +++
 libavutil/imgutils.c |  8 ++------
 libavutil/imgutils.h | 10 ++++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/doc/APIchanges b/doc/APIchanges
index 5889fb246b..08cd0804b9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+201x-xx-xx - xxxxxxxxxx - lavu 56.xx.xxx - imgutils.h
+  Add av_memset_bytes()
+
 2018-12-21 - 2744d6b364 - lavu 56.25.100 - hdr_dynamic_metadata.h
   Add AV_FRAME_DATA_DYNAMIC_HDR_PLUS enum value, av_dynamic_hdr_plus_alloc(),
   av_dynamic_hdr_plus_create_side_data() functions, and related structs.
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 4938a7ef67..229c289c11 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -494,11 +494,7 @@  int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
     return size;
 }
 
-// Fill dst[0..dst_size] with the bytes in clear[0..clear_size]. The clear
-// bytes are repeated until dst_size is reached. If dst_size is unaligned (i.e.
-// dst_size%clear_size!=0), the remaining data will be filled with the beginning
-// of the clear data only.
-static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
+void av_memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
                          size_t clear_size)
 {
     size_t pos = 0;
@@ -653,7 +649,7 @@  int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4],
         int plane_h = ((height + ( 1 << chroma_div) - 1)) >> chroma_div;
 
         for (; plane_h > 0; plane_h--) {
-            memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]);
+            av_memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]);
             data += dst_linesize[plane];
         }
     }
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index 5b790ecf0a..2f0f4b9106 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -269,6 +269,16 @@  int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4],
                         enum AVPixelFormat pix_fmt, enum AVColorRange range,
                         int width, int height);
 
+/**
+ * Fill dst[0..dst_size] with the bytes in clear[0..clear_size]. The clear
+ * bytes are repeated until dst_size is reached. If dst_size is unaligned (i.e.
+ * dst_size%clear_size!=0), the remaining data will be filled with the beginning
+ * of the clear data only.
+ */
+void av_memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
+                     size_t clear_size);
+
+
 /**
  * @}
  */