From patchwork Fri Dec 28 19:26:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 11571 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 4AD0544DFFB for ; Fri, 28 Dec 2018 21:29:13 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F146F68A6DD; Fri, 28 Dec 2018 21:29:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-3.mx.upcmail.net (vie01a-dmta-pe06-3.mx.upcmail.net [84.116.36.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CE3D168A1F0 for ; Fri, 28 Dec 2018 21:29:03 +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 1gcxok-00076u-3j for ffmpeg-devel@ffmpeg.org; Fri, 28 Dec 2018 20:29:10 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id cxmfgLaHC2WSscxmfgcbPT; Fri, 28 Dec 2018 20:27:01 +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: Fri, 28 Dec 2018 20:26:57 +0100 Message-Id: <20181228192658.16628-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfPgmZx2eWBC3bmDF65UrO2n4tPs3E/k4t6Di5u3w2ICccTarY1iEa9F1cCerdTpqctPnqqzvKm1zhNp1j1ElCEWErffhoMkG1jTN0P7T4uixXTTyQC7B glOvc6zNCvvr/P5vFWfhUHzENFSOVpjFa+zIEUmeNbPFG4eGnVqaGFmJ 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 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); + + /** * @} */