A possible tiny decoding slowdown is not worth the loss of functionality.
---
 libavcodec/mpeg4video.h    | 8 +-------
 libavcodec/mpeg4videodec.c | 8 ++++----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h
index 4a4995e..68b3ded 100644
--- a/libavcodec/mpeg4video.h
+++ b/libavcodec/mpeg4video.h
@@ -157,12 +157,6 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int 
my);
 
 extern uint8_t ff_mpeg4_static_rl_table_store[3][2][2 * MAX_RUN + MAX_LEVEL + 
3];
 
-#if 0 //3IV1 is quite rare and it slows things down a tiny bit
-#define IS_3IV1 s->codec_tag == AV_RL32("3IV1")
-#else
-#define IS_3IV1 0
-#endif
-
 /**
  * Predict the dc.
  * encoding quantized level -> quantized diff
@@ -181,7 +175,7 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext *s, int 
n, int level,
         scale = s->y_dc_scale;
     else
         scale = s->c_dc_scale;
-    if (IS_3IV1)
+    if (s->codec_tag == AV_RL32("3IV1"))
         scale = 8;
 
     wrap   = s->block_wrap[n];
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index e16d482..b07f03d 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -559,7 +559,7 @@ static inline int mpeg4_decode_dc(MpegEncContext *s, int n, 
int *dir_ptr)
     if (code == 0) {
         level = 0;
     } else {
-        if (IS_3IV1) {
+        if (s->codec_tag == AV_RL32("3IV1")) {
             if (code == 1)
                 level = 2 * get_bits1(&s->gb) - 1;
             else {
@@ -1068,7 +1068,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
                     int cache;
                     cache = GET_CACHE(re, &s->gb);
 
-                    if (IS_3IV1)
+                    if (s->codec_tag == AV_RL32("3IV1"))
                         cache ^= 0xC0000000;
 
                     if (cache & 0x80000000) {
@@ -1081,7 +1081,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext 
*ctx, int16_t *block,
                             SKIP_COUNTER(re, &s->gb, 2 + 1 + 6);
                             UPDATE_CACHE(re, &s->gb);
 
-                            if (IS_3IV1) {
+                            if (s->codec_tag == AV_RL32("3IV1")) {
                                 level = SHOW_SBITS(re, &s->gb, 12);
                                 LAST_SKIP_BITS(re, &s->gb, 12);
                             } else {
@@ -2122,7 +2122,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, 
GetBitContext *gb)
         }
     }
 
-    if (IS_3IV1)
+    if (s->codec_tag == AV_RL32("3IV1"))
         time_increment = get_bits1(gb);        // FIXME investigate further
     else
         time_increment = get_bits(gb, ctx->time_increment_bits);
-- 
2.7.3

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to