summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/h261.c26
-rw-r--r--tests/ffmpeg.regression.ref4
-rw-r--r--tests/rotozoom.regression.ref4
3 files changed, 14 insertions, 20 deletions
diff --git a/libavcodec/h261.c b/libavcodec/h261.c
index 490e0d30a6..e7fa63e923 100644
--- a/libavcodec/h261.c
+++ b/libavcodec/h261.c
@@ -220,12 +220,11 @@ void ff_h261_encode_mb(MpegEncContext * s,
int motion_x, int motion_y)
{
H261Context * h = (H261Context *)s;
- int old_mtype, mvd, mv_diff_x, mv_diff_y, i, cbp;
+ int mvd, mv_diff_x, mv_diff_y, i, cbp;
cbp = 63; // avoid warning
mvd = 0;
h->current_mba++;
- old_mtype = h->mtype;
h->mtype = 0;
if (!s->mb_intra){
@@ -233,14 +232,8 @@ void ff_h261_encode_mb(MpegEncContext * s,
cbp= get_cbp(s, block);
/* mvd indicates if this block is motion compensated */
- if(((motion_x >> 1) - h->current_mv_x != 0) || ((motion_y >> 1 ) - h->current_mv_y) != 0){
- mvd = 1;
- }
- else if((motion_x >> 1 == 0) && (motion_y >> 1 == 0)){
- mvd = 0;
- }
- else
- mvd = 1;
+ mvd = motion_x | motion_y;
+
if((cbp | mvd | s->dquant ) == 0) {
/* skip macroblock */
s->skip_count++;
@@ -255,14 +248,15 @@ void ff_h261_encode_mb(MpegEncContext * s,
/* calculate MTYPE */
if(!s->mb_intra){
- h->mtype+=2;
- if(mvd == 1){
- h->mtype+=2;
- if(cbp!=0)
- h->mtype+=1;
+ h->mtype++;
+
+ if(mvd || s->loop_filter)
+ h->mtype+=3;
if(s->loop_filter)
h->mtype+=3;
- }
+ if(cbp || s->dquant)
+ h->mtype++;
+ assert(h->mtype > 1);
}
if(s->dquant)
diff --git a/tests/ffmpeg.regression.ref b/tests/ffmpeg.regression.ref
index a55079701b..4fb04b148b 100644
--- a/tests/ffmpeg.regression.ref
+++ b/tests/ffmpeg.regression.ref
@@ -35,8 +35,8 @@ a5bd577163968edab00058f2c8d5efab *./data/a-wmv2.avi
682132 ./data/a-wmv2.avi
09253222ab4eb95628c931a86006a2b1 *./data/out.yuv
stddev: 8.02 PSNR:30.04 bytes:7602176
-394b91b7ef6b94e375316cc3037e68c5 *./data/a-h261.avi
-779660 ./data/a-h261.avi
+c12437d78325d6634ff77a49bf1869e8 *./data/a-h261.avi
+779222 ./data/a-h261.avi
1dd0be7be463c1a338d1b848e926a0b8 *./data/out.yuv
stddev: 9.17 PSNR:28.87 bytes:7602176
fa556e599181bf9328a811a1ce9aa022 *./data/a-h263.avi
diff --git a/tests/rotozoom.regression.ref b/tests/rotozoom.regression.ref
index 54facb7c89..3b09df1028 100644
--- a/tests/rotozoom.regression.ref
+++ b/tests/rotozoom.regression.ref
@@ -35,8 +35,8 @@ stddev: 5.33 PSNR:33.58 bytes:7602176
129214 ./data/a-wmv2.avi
f80d2809e79af3ebcfe831deab9af03c *./data/out.yuv
stddev: 5.33 PSNR:33.58 bytes:7602176
-39726b83734fa58d33d99098511cdb98 *./data/a-h261.avi
-194348 ./data/a-h261.avi
+41050f885f7ea9594643e5dbf8ea30da *./data/a-h261.avi
+193452 ./data/a-h261.avi
c74fbf0b0faf1124e172413c059ab45a *./data/out.yuv
stddev: 6.40 PSNR:31.99 bytes:7602176
ef053b1fec77a49eb8a27510b81e4041 *./data/a-h263.avi