[FFmpeg-cvslog] avcodec/speedhqenc: Inline ff_speedhq_mb_y_order_to_mb()
Andreas Rheinhardt
git at videolan.org
Fri Mar 7 16:22:15 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Mar 3 16:27:44 2025 +0100| [fc158f3d40bff59fc79e061c3fb68157acfbee47] | committer: Andreas Rheinhardt
avcodec/speedhqenc: Inline ff_speedhq_mb_y_order_to_mb()
It is an extremely simple function that is only called once,
so it should be inlined.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fc158f3d40bff59fc79e061c3fb68157acfbee47
---
libavcodec/speedhqenc.c | 16 ----------------
libavcodec/speedhqenc.h | 16 +++++++++++++++-
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/libavcodec/speedhqenc.c b/libavcodec/speedhqenc.c
index dda5444434..87497f5f85 100644
--- a/libavcodec/speedhqenc.c
+++ b/libavcodec/speedhqenc.c
@@ -272,22 +272,6 @@ void ff_speedhq_encode_mb(MpegEncContext *s, int16_t block[12][64])
s->i_tex_bits += get_bits_diff(s);
}
-static int ff_speedhq_mb_rows_in_slice(int slice_num, int mb_height)
-{
- return mb_height / 4 + (slice_num < (mb_height % 4));
-}
-
-int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_slice)
-{
- int slice_num = 0;
- while (mb_y_order >= ff_speedhq_mb_rows_in_slice(slice_num, mb_height)) {
- mb_y_order -= ff_speedhq_mb_rows_in_slice(slice_num, mb_height);
- slice_num++;
- }
- *first_in_slice = (mb_y_order == 0);
- return mb_y_order * 4 + slice_num;
-}
-
const FFCodec ff_speedhq_encoder = {
.p.name = "speedhq",
CODEC_LONG_NAME("NewTek SpeedHQ"),
diff --git a/libavcodec/speedhqenc.h b/libavcodec/speedhqenc.h
index 0c52e6a380..15be9764d7 100644
--- a/libavcodec/speedhqenc.h
+++ b/libavcodec/speedhqenc.h
@@ -40,6 +40,20 @@ void ff_speedhq_encode_mb(MpegEncContext *s, int16_t block[12][64]);
void ff_speedhq_encode_picture_header(MpegEncContext *s);
void ff_speedhq_end_slice(MpegEncContext *s);
-int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_slice);
+static inline int ff_speedhq_mb_rows_in_slice(int slice_num, int mb_height)
+{
+ return mb_height / 4 + (slice_num < (mb_height % 4));
+}
+
+static inline int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_slice)
+{
+ int slice_num = 0;
+ while (mb_y_order >= ff_speedhq_mb_rows_in_slice(slice_num, mb_height)) {
+ mb_y_order -= ff_speedhq_mb_rows_in_slice(slice_num, mb_height);
+ slice_num++;
+ }
+ *first_in_slice = (mb_y_order == 0);
+ return mb_y_order * 4 + slice_num;
+}
#endif /* AVCODEC_SPEEDHQENC_H */
More information about the ffmpeg-cvslog
mailing list