From patchwork Mon Oct 26 13:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 23230 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 A97E944AB2A for ; Mon, 26 Oct 2020 15:42:20 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 69D2868AB99; Mon, 26 Oct 2020 15:42:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail.red.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6ADAB68811D for ; Mon, 26 Oct 2020 15:42:14 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail.red.khirnov.net (Postfix) with ESMTP id A927629651D for ; Mon, 26 Oct 2020 14:42:12 +0100 (CET) Received: from mail.red.khirnov.net ([IPv6:::1]) by localhost (mail.red.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Cgjk1E-7m92I for ; Mon, 26 Oct 2020 14:42:09 +0100 (CET) Received: from libav.daenerys.khirnov.net (libav.daenerys.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.daenerys.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail.red.khirnov.net (Postfix) with ESMTPS id B06F529651A for ; Mon, 26 Oct 2020 14:42:09 +0100 (CET) Received: by libav.daenerys.khirnov.net (Postfix, from userid 1000) id 5F91E20E008C; Mon, 26 Oct 2020 14:42:08 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 26 Oct 2020 14:41:58 +0100 Message-Id: <20201026134159.24101-5-anton@khirnov.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201026134159.24101-1-anton@khirnov.net> References: <20201026134159.24101-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] put_bits: make avpriv_copy_bits() lavc-local 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" It is not used outside of lavc anymore. Keep the avpriv exported symbol around until the next bump to preserve ABI compatibility. --- libavcodec/bitstream.c | 6 +++++- libavcodec/mpeg4videoenc.c | 4 ++-- libavcodec/mpegvideo_enc.c | 8 ++++---- libavcodec/put_bits.h | 5 +++-- libavcodec/svq1enc.c | 2 +- libavcodec/wmalosslessdec.c | 4 ++-- libavcodec/wmaprodec.c | 4 ++-- libavcodec/wmavoice.c | 4 ++-- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c index 2eb8aac5fc..21f58a91fa 100644 --- a/libavcodec/bitstream.c +++ b/libavcodec/bitstream.c @@ -50,6 +50,10 @@ void avpriv_align_put_bits(PutBitContext *s) { align_put_bits(s); } +void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length) +{ + ff_copy_bits(pb, src, length); +} #endif void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) @@ -62,7 +66,7 @@ void ff_put_string(PutBitContext *pb, const char *string, int terminate_string) put_bits(pb, 8, 0); } -void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length) +void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length) { int words = length >> 4; int bits = length & 15; diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c index 72e6f99eaa..b3fa910c64 100644 --- a/libavcodec/mpeg4videoenc.c +++ b/libavcodec/mpeg4videoenc.c @@ -1354,8 +1354,8 @@ void ff_mpeg4_merge_partitions(MpegEncContext *s) flush_put_bits(&s->tex_pb); set_put_bits_buffer_size(&s->pb, s->pb2.buf_end - s->pb.buf); - avpriv_copy_bits(&s->pb, s->pb2.buf, pb2_len); - avpriv_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len); + ff_copy_bits(&s->pb, s->pb2.buf, pb2_len); + ff_copy_bits(&s->pb, s->tex_pb.buf, tex_pb_len); s->last_bits = put_bits_count(&s->pb); } diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index b16faf6b55..f16b26c9f2 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -3351,18 +3351,18 @@ FF_ENABLE_DEPRECATION_WARNINGS pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); - avpriv_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); + ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); - avpriv_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); + ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); - avpriv_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); + ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } s->last_bits= put_bits_count(&s->pb); @@ -3589,7 +3589,7 @@ static void merge_context_after_encode(MpegEncContext *dst, MpegEncContext *src) av_assert1(put_bits_count(&src->pb) % 8 ==0); av_assert1(put_bits_count(&dst->pb) % 8 ==0); - avpriv_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb)); + ff_copy_bits(&dst->pb, src->pb.buf, put_bits_count(&src->pb)); flush_put_bits(&dst->pb); } diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h index f6310224ef..8e6f70893d 100644 --- a/libavcodec/put_bits.h +++ b/libavcodec/put_bits.h @@ -149,11 +149,12 @@ static inline void flush_put_bits_le(PutBitContext *s) #if FF_API_AVPRIV_PUT_BITS void avpriv_align_put_bits(PutBitContext *s); +void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length); #endif #ifdef BITSTREAM_WRITER_LE #define ff_put_string ff_put_string_unsupported_here -#define avpriv_copy_bits avpriv_copy_bits_unsupported_here +#define ff_copy_bits ff_copy_bits_unsupported_here #else /** @@ -169,7 +170,7 @@ void ff_put_string(PutBitContext *pb, const char *string, * * @param length the number of bits of src to copy */ -void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length); +void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length); #endif static inline void put_bits_no_assert(PutBitContext *s, int n, BitBuf value) diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 9e249aefe4..4fac0c26e5 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -472,7 +472,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, if (best != 2) for (i = 5; i >= 0; i--) - avpriv_copy_bits(&s->pb, reorder_buffer[best][i], + ff_copy_bits(&s->pb, reorder_buffer[best][i], count[best][i]); if (best == 0) s->hdsp.put_pixels_tab[0][0](decoded, temp, stride, 16); diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index b8d0f6220d..a8fd99774e 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -1160,14 +1160,14 @@ static void save_bits(WmallDecodeCtx *s, GetBitContext* gb, int len, s->num_saved_bits += len; if (!append) { - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), + ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), s->num_saved_bits); } else { int align = 8 - (get_bits_count(gb) & 7); align = FFMIN(align, len); put_bits(&s->pb, align, get_bits(gb, align)); len -= align; - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); + ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); } skip_bits_long(gb, len); diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index cbf5fa7fd5..63e7680f9a 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1579,14 +1579,14 @@ static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, s->num_saved_bits += len; if (!append) { - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), + ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), s->num_saved_bits); } else { int align = 8 - (get_bits_count(gb) & 7); align = FFMIN(align, len); put_bits(&s->pb, align, get_bits(gb, align)); len -= align; - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); + ff_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); } skip_bits_long(gb, len); diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index f6550c6a71..a588bb6c84 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1865,7 +1865,7 @@ static int parse_packet_header(WMAVoiceContext *s) * @param size size of the source data, in bytes * @param gb bit I/O context specifying the current position in the source. * data. This function might use this to align the bit position to - * a whole-byte boundary before calling #avpriv_copy_bits() on aligned + * a whole-byte boundary before calling #ff_copy_bits() on aligned * source data * @param nbits the amount of bits to copy from source to target * @@ -1886,7 +1886,7 @@ static void copy_bits(PutBitContext *pb, rmn_bits &= 7; rmn_bytes >>= 3; if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0) put_bits(pb, rmn_bits, get_bits(gb, rmn_bits)); - avpriv_copy_bits(pb, data + size - rmn_bytes, + ff_copy_bits(pb, data + size - rmn_bytes, FFMIN(nbits - rmn_bits, rmn_bytes << 3)); }