Commit 51cd3fc
authored
fix(amf): disable LTR by default to match FFmpeg amfenc behavior (#631)
* fix(amf): disable LTR by default to match FFmpeg amfenc behavior
PR #630 enabled native AMF LTR with 4 slots by default to improve weak-network RFI recovery, but this introduced a regression: static screen regions retain encoder artifacts (color blocks) until motion forces a refresh.
Root cause: with LTR_MODE_RESET_UNUSED + ULTRA_LOW_LATENCY usage, the IDR-time LTR baseline (slot 0) is permanently referenced by P-frames for static macroblocks. The slot-0 quantization noise from IDR is never overwritten, so static regions inherit it forever; only motion forces a fresh intra block.
FFmpeg's libavcodec/amfenc.c does NOT use the native AMF LTR API at all (it only optionally uses Pre-Analysis LTR which is a different mechanism). That is why the legacy FFmpeg-AMF path never exhibited this artifact.
Fix: revert default amd_ltr_frames to 0 so out-of-the-box behavior matches FFmpeg. Users who actually need RFI on lossy networks can opt in via amd_ltr_frames>=1; the slot rotation logic from #630 still applies in that case.
Refs #630
* docs(amf): explain LTR opt-in trade-off and dead-code rationale
Add inline comments at the three LTR enable sites and the effective_ltr_slots calc explaining: (1) why we keep the implementation despite default-disabled, (2) the IDR storm risk if RFI is removed entirely, (3) the static-region color-block trade-off when users opt in.1 parent 31f9a0d commit 51cd3fc
3 files changed
Lines changed: 32 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
156 | 172 | | |
157 | 173 | | |
158 | 174 | | |
| |||
217 | 233 | | |
218 | 234 | | |
219 | 235 | | |
| 236 | + | |
| 237 | + | |
220 | 238 | | |
221 | 239 | | |
222 | 240 | | |
| |||
298 | 316 | | |
299 | 317 | | |
300 | 318 | | |
| 319 | + | |
| 320 | + | |
301 | 321 | | |
302 | 322 | | |
303 | 323 | | |
| |||
595 | 615 | | |
596 | 616 | | |
597 | 617 | | |
598 | | - | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
599 | 623 | | |
600 | 624 | | |
601 | 625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
0 commit comments