1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

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@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-03-03 16:27:44 +01:00
parent 49c38761f1
commit fc158f3d40
2 changed files with 15 additions and 17 deletions

View File

@ -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"),

View File

@ -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 */