[FFmpeg-devel] [PATCH 5/5] avcodec/utvideodec: Factor multiply out of inner loop
Michael Niedermayer
michael at niedermayer.cc
Tue Jun 27 22:47:35 EEST 2017
0.5% faster loop
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/utvideodec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
index 788f4475b9..a20e28320c 100644
--- a/libavcodec/utvideodec.c
+++ b/libavcodec/utvideodec.c
@@ -196,7 +196,8 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
prev = 0x200;
for (j = sstart; j < send; j++) {
- for (i = 0; i < width * step; i += step) {
+ int ws = width * step;
+ for (i = 0; i < ws; i += step) {
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
if (pix < 0) {
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
@@ -300,7 +301,8 @@ static int decode_plane(UtvideoContext *c, int plane_no,
prev = 0x80;
for (j = sstart; j < send; j++) {
- for (i = 0; i < width * step; i += step) {
+ int ws = width * step;
+ for (i = 0; i < ws; i += step) {
pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);
if (pix < 0) {
av_log(c->avctx, AV_LOG_ERROR, "Decoding error\n");
--
2.13.0
More information about the ffmpeg-devel
mailing list