From b74e47c4ff5bca998936c0d8b9a0892104a7403d Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 13 Dec 2021 19:55:39 +0100 Subject: avcodec/utils: Unavpriv avpriv_toupper4() This function is quite small (96B with GCC 11.2 on x64 Ubuntu 21.10 at -O3), making it more economical to duplicate it into libavformat instead of exporting it as avpriv: Doing so saves 2x24B in .dynsim, 2x16B in .dynstr, 2x2B .gnu.version, 24B in .rela.plt, 16B in .plt, 16B in .plt.sec (if enabled), 4B .gnu.hash; besides the actual duplicated code this also adds 2x8B .eh_frame_hdr and 24B .eh_frame. In other words: Duplicating is neutral size-wise (it is also presumed neutral for other systems). Given that it avoids the runtime overhead of dynamic symbols, it is advantageouos to duplicate the function. Signed-off-by: Andreas Rheinhardt --- libavcodec/to_upper4.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 libavcodec/to_upper4.h (limited to 'libavcodec/to_upper4.h') diff --git a/libavcodec/to_upper4.h b/libavcodec/to_upper4.h new file mode 100644 index 0000000000..d9648b5ef6 --- /dev/null +++ b/libavcodec/to_upper4.h @@ -0,0 +1,37 @@ +/* + * Converting FOURCCs to uppercase + * Copyright (c) 2001 Fabrice Bellard + * Copyright (c) 2002-2004 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_TO_UPPER4_H +#define AVCODEC_TO_UPPER4_H + +#include "libavutil/avstring.h" +#include "internal.h" + +unsigned int ff_toupper4(unsigned int x) +{ + return av_toupper(x & 0xFF) | + (av_toupper((x >> 8) & 0xFF) << 8) | + (av_toupper((x >> 16) & 0xFF) << 16) | +((unsigned)av_toupper((x >> 24) & 0xFF) << 24); +} + +#endif -- cgit v1.2.3