From patchwork Thu Jan 31 13:09:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11926 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2A92644C9AF for ; Thu, 31 Jan 2019 15:11:03 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C2DA68ACC7; Thu, 31 Jan 2019 15:10:51 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD17768A974 for ; Thu, 31 Jan 2019 15:10:44 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1gpC7W-0005IS-0g for ffmpeg-devel@ffmpeg.org; Thu, 31 Jan 2019 14:11:06 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id pC5ZgPnFo2WSspC5ZgiMTS; Thu, 31 Jan 2019 14:09:05 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=E7kcWpVl c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=jEEX7dZhXfUzb2p2bVcA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 31 Jan 2019 14:09:01 +0100 Message-Id: <20190131130902.26536-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfLonrZ0E2449gkiqdjFgJvP0mVkoH8GtexwxvqTPYZ2UoCcyWtWYu1ry9BfUYaBXGRtIl0FGdwwvfycTlyxp9Rh9AiMx9B5PgJWb+XEUoPaMrtvSlLI9 2hIQb9U6GLLv6SEbmCFCx82h3O+gHZ9XWxwxtIfwFDiqlRWVKV6Rqkmm Subject: [FFmpeg-devel] [PATCH 1/2] avutil: export av_memset_bytes() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This function is useful in more cases than just imgutils Signed-off-by: Michael Niedermayer --- doc/APIchanges | 3 +++ libavutil/imgutils.c | 8 ++------ libavutil/imgutils.h | 10 ++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 784a5e5bd2..dc239cbd47 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -21,6 +21,9 @@ API changes, most recent first: 2019-01-08 - xxxxxxxxxx - lavu 56.26.100 - frame.h Add AV_FRAME_DATA_REGIONS_OF_INTEREST +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 afc73e2def..3cc186b79f 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) { int same = 1; @@ -636,7 +632,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); + + /** * @} */