summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-26 20:02:25 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-07-31 01:53:19 +0200
commit145236741d9a7c18da4ee22c30b777b781bc5ac8 (patch)
treeb471d3defc31f5032e7f78ef16aecc73356cc083 /libavcodec/mpegvideo.h
parentdd20ebb2ca2a572557de612eef2df1a57738efde (diff)
downloadffmpeg-145236741d9a7c18da4ee22c30b777b781bc5ac8.tar.gz
avcodec/mpegvideo: Inline values in ff_update_block_index()
This is possible for most of the callers, because e.g. only the MPEG-4 decoder can have bits_per_raw_sample > 8. Also most mpegvideo-based codecs are 420 only. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpegvideo.h')
-rw-r--r--libavcodec/mpegvideo.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 82889a0edd..195a2b3238 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -590,9 +590,11 @@ void ff_mpv_motion(MpegEncContext *s,
op_pixels_func (*pix_op)[4],
qpel_mc_func (*qpix_op)[16]);
-static inline void ff_update_block_index(MpegEncContext *s){
- const int bytes_per_pixel = 1 + (s->avctx->bits_per_raw_sample > 8);
- const int block_size= (8*bytes_per_pixel) >> s->avctx->lowres;
+static inline void ff_update_block_index(MpegEncContext *s, int bits_per_raw_sample,
+ int lowres, int chroma_x_shift)
+{
+ const int bytes_per_pixel = 1 + (bits_per_raw_sample > 8);
+ const int block_size = (8 * bytes_per_pixel) >> lowres;
s->block_index[0]+=2;
s->block_index[1]+=2;
@@ -601,8 +603,8 @@ static inline void ff_update_block_index(MpegEncContext *s){
s->block_index[4]++;
s->block_index[5]++;
s->dest[0]+= 2*block_size;
- s->dest[1]+= (2 >> s->chroma_x_shift) * block_size;
- s->dest[2]+= (2 >> s->chroma_x_shift) * block_size;
+ s->dest[1] += (2 >> chroma_x_shift) * block_size;
+ s->dest[2] += (2 >> chroma_x_shift) * block_size;
}
#endif /* AVCODEC_MPEGVIDEO_H */