mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
fix and cleanup h261 mb_type selection
Originally committed as revision 3647 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
13e5b1f684
commit
9740687b6b
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user