History

VP8: idct_mb optimizations

Currently uses AV_RL32 instead of AV_RL32A, as the latter doesn't exist yet. (cherry picked from commit 62457f9052ea15123688455aad866cb070634f13)

Jason Garrett-Glaser committed 15 years ago

Commit a1b0a3c1 parent a239d531 file · +16 −16Browse files

Unified · Split

libavcodec/vp8.c+16−16
@@ -1421,17 +1421,17 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo · 1420 unmodified lines
14211421 if (mb->mode != MODE_I4x4) {
14221422 uint8_t *y_dst = dst[0];
14231423 for (y = 0; y < 4; y++) {
1424− uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[y]);
1424+ uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[y]);
14251425 if (nnz4) {
14261426 if (nnz4&~0x01010101) {
14271427 for (x = 0; x < 4; x++) {
1428− int nnz = s->non_zero_count_cache[y][x];
1429− if (nnz) {
1430− if (nnz == 1)
1431− s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize);
1432− else
1433− s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize);
1434− }
1428+ if ((uint8_t)nnz4 == 1)
1429+ s->vp8dsp.vp8_idct_dc_add(y_dst+4*x, s->block[y][x], s->linesize);
1430+ else if((uint8_t)nnz4 > 1)
1431+ s->vp8dsp.vp8_idct_add(y_dst+4*x, s->block[y][x], s->linesize);
1432+ nnz4 >>= 8;
1433+ if (!nnz4)
1434+ break;
14351435 }
14361436 } else {
14371437 s->vp8dsp.vp8_idct_dc_add4y(y_dst, s->block[y], s->linesize);
@@ -1442,19 +1442,19 @@ static av_always_inline void idct_mb(VP8Context *s, uint8_t *dst[3], VP8Macroblo · 4 unmodified lines
14421442 }
14431443
14441444 for (ch = 0; ch < 2; ch++) {
1445− uint32_t nnz4 = AV_RN32A(s->non_zero_count_cache[4+ch]);
1445+ uint32_t nnz4 = AV_RL32(s->non_zero_count_cache[4+ch]);
14461446 if (nnz4) {
14471447 uint8_t *ch_dst = dst[1+ch];
14481448 if (nnz4&~0x01010101) {
14491449 for (y = 0; y < 2; y++) {
14501450 for (x = 0; x < 2; x++) {
1451− int nnz = s->non_zero_count_cache[4+ch][(y<<1)+x];
1452− if (nnz) {
1453− if (nnz == 1)
1454− s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1455− else
1456− s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1457− }
1451+ if ((uint8_t)nnz4 == 1)
1452+ s->vp8dsp.vp8_idct_dc_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1453+ else if((uint8_t)nnz4 > 1)
1454+ s->vp8dsp.vp8_idct_add(ch_dst+4*x, s->block[4+ch][(y<<1)+x], s->uvlinesize);
1455+ nnz4 >>= 8;
1456+ if (!nnz4)
1457+ break;
14581458 }
14591459 ch_dst += 4*s->uvlinesize;
14601460 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t