[FFmpeg-cvslog] lavc: move get_b_cbp() from h263.h to mpeg4videoenc.c

Anton Khirnov git at videolan.org
Mon Oct 24 01:58:25 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Oct 21 16:02:29 2011 +0200| [1deb66c50cea1891fb8ddcc12ec6960557b93209] | committer: Anton Khirnov

lavc: move get_b_cbp() from h263.h to mpeg4videoenc.c

It's not used anywhere else.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1deb66c50cea1891fb8ddcc12ec6960557b93209
---

 libavcodec/h263.h          |   42 ------------------------------------------
 libavcodec/mpeg4videoenc.c |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 1dc3007..73c5966 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -200,48 +200,6 @@ static inline int get_p_cbp(MpegEncContext * s,
     return cbp;
 }
 
-static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
-                            int motion_x, int motion_y, int mb_type){
-    int cbp=0, i;
-
-    if(s->flags & CODEC_FLAG_CBP_RD){
-        int score=0;
-        const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
-
-        for(i=0; i<6; i++){
-            if(s->coded_score[i] < 0){
-                score += s->coded_score[i];
-                cbp |= 1 << (5 - i);
-            }
-        }
-
-        if(cbp){
-            int zero_score= -6;
-            if ((motion_x | motion_y | s->dquant | mb_type) == 0){
-                zero_score-= 4; //2*MV + mb_type + cbp bit
-            }
-
-            zero_score*= lambda;
-            if(zero_score <= score){
-                cbp=0;
-            }
-        }
-
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){
-                s->block_last_index[i]= -1;
-                s->dsp.clear_block(s->block[i]);
-            }
-        }
-    }else{
-        for (i = 0; i < 6; i++) {
-            if (s->block_last_index[i] >= 0)
-                cbp |= 1 << (5 - i);
-        }
-    }
-    return cbp;
-}
-
 static inline void memsetw(short *tab, int val, int n)
 {
     int i;
diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
index cbcd3cc..3072ace 100644
--- a/libavcodec/mpeg4videoenc.c
+++ b/libavcodec/mpeg4videoenc.c
@@ -425,6 +425,46 @@ static inline void mpeg4_encode_blocks(MpegEncContext * s, DCTELEM block[6][64],
     }
 }
 
+static inline int get_b_cbp(MpegEncContext * s, DCTELEM block[6][64],
+                            int motion_x, int motion_y, int mb_type)
+{
+    int cbp = 0, i;
+
+    if (s->flags & CODEC_FLAG_CBP_RD) {
+        int score = 0;
+        const int lambda = s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
+
+        for (i = 0; i < 6; i++)
+            if (s->coded_score[i] < 0) {
+                score += s->coded_score[i];
+                cbp   |= 1 << (5 - i);
+            }
+
+        if (cbp) {
+            int zero_score = -6;
+            if ((motion_x | motion_y | s->dquant | mb_type) == 0)
+                zero_score -= 4; //2*MV + mb_type + cbp bit
+
+            zero_score *= lambda;
+            if (zero_score <= score)
+                cbp = 0;
+        }
+
+        for (i = 0; i < 6; i++) {
+            if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i)) & 1) == 0) {
+                s->block_last_index[i] = -1;
+                s->dsp.clear_block(s->block[i]);
+            }
+        }
+    } else {
+        for (i = 0; i < 6; i++) {
+            if (s->block_last_index[i] >= 0)
+                cbp |= 1 << (5 - i);
+        }
+    }
+    return cbp;
+}
+
 //FIXME this is duplicated to h263.c
 static const int dquant_code[5]= {1,0,9,2,3};
 



More information about the ffmpeg-cvslog mailing list