diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-03-30 23:28:24 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-04-05 20:02:37 +0200 |
commit | 4243da4ff42e306b3622b181e12f5cd127d21414 (patch) | |
tree | a74a6b85a179795431a0ee2b259be8c35f0ed799 /libavcodec/utils.c | |
parent | ce7dbd0481f990e249c2a05f179228489d3062cf (diff) | |
download | ffmpeg-4243da4ff42e306b3622b181e12f5cd127d21414.tar.gz |
avcodec/codec_internal: Use union for FFCodec decode/encode callbacks
This is possible, because every given FFCodec has to implement
exactly one of these. Doing so decreases sizeof(FFCodec) and
therefore decreases the size of the binary.
Notice that in case of position-independent code the decrease
is in .data.rel.ro, so that this translates to decreased
memory consumption.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 34d97022b7..eb7e505a62 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -74,13 +74,17 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size) int av_codec_is_encoder(const AVCodec *avcodec) { const FFCodec *const codec = ffcodec(avcodec); - return codec && (codec->encode_sub || codec->encode2 || codec->receive_packet); + return codec && (codec->cb_type == FF_CODEC_CB_TYPE_ENCODE || + codec->cb_type == FF_CODEC_CB_TYPE_ENCODE_SUB || + codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET); } int av_codec_is_decoder(const AVCodec *avcodec) { const FFCodec *const codec = ffcodec(avcodec); - return codec && (codec->decode || codec->decode_sub || codec->receive_frame); + return codec && (codec->cb_type == FF_CODEC_CB_TYPE_DECODE || + codec->cb_type == FF_CODEC_CB_TYPE_DECODE_SUB || + codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME); } int ff_set_dimensions(AVCodecContext *s, int width, int height) |