Said block will only be referenced by blocks from the same macroblock, which will read the new AC values instead of the reset values from this function.
Unified · Split
| @@ -506,7 +506,9 @@ void ff_clean_intra_table_entries(MpegEncContext *s) · 505 unmodified lines | ||
| 506 | 506 | /* ac pred */ |
| 507 | 507 | int16_t (*ac_val)[16] = s->ac_val[0]; |
| 508 | 508 | av_assume(!((uintptr_t)ac_val & 0xF)); |
| 509 | − memset(ac_val[xy ], 0, 2 * sizeof(*ac_val)); | |
| 509 | + // Don't reset the upper-left luma block, as it will only ever be | |
| 510 | + // referenced by blocks from the same macroblock. | |
| 511 | + memset(ac_val[xy + 1], 0, sizeof(*ac_val)); | |
| 510 | 512 | memset(ac_val[xy + wrap], 0, 2 * sizeof(*ac_val)); |
| 511 | 513 | /* ac pred */ |
| 512 | 514 | memset(ac_val[uxy], 0, sizeof(*ac_val)); |