This makes the code more testable as uninitialized fields are 0 and not random values from the last call
Unified · Split
| @@ -424,7 +424,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit, · 423 unmodified lines | ||
| 424 | 424 | uint32_t curcode, int curlen, |
| 425 | 425 | int curlimit, int curlevel, |
| 426 | 426 | const int minlen, const int max, |
| 427 | − unsigned* levelcnt, VLC_MULTI_ELEM *info) | |
| 427 | + unsigned* levelcnt, VLC_MULTI_ELEM info) | |
| 428 | 428 | { |
| 429 | 429 | int max_symbols = VLC_MULTI_MAX_SYMBOLS >> is16bit; |
| 430 | 430 | for (int i = num-1; i >= max; i--) { |
| @@ -440,16 +440,16 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit, · 9 unmodified lines | ||
| 440 | 440 | code = curcode + (buf[t].code >> curlen); |
| 441 | 441 | newlimit = curlimit - l; |
| 442 | 442 | l += curlen; |
| 443 | − if (is16bit) AV_WN16(info->val+2*curlevel, sym); | |
| 444 | − else info->val[curlevel] = sym&0xFF; | |
| 443 | + if (is16bit) AV_WN16(info.val+2*curlevel, sym); | |
| 444 | + else info.val[curlevel] = sym&0xFF; | |
| 445 | 445 | |
| 446 | 446 | if (curlevel) { // let's not add single entries |
| 447 | 447 | uint32_t val = code >> (32 - numbits); |
| 448 | 448 | uint32_t nb = val + (1U << (numbits - l)); |
| 449 | − info->len = l; | |
| 450 | − info->num = curlevel+1; | |
| 449 | + info.len = l; | |
| 450 | + info.num = curlevel+1; | |
| 451 | 451 | for (; val < nb; val++) |
| 452 | − AV_COPY64(table+val, info); | |
| 452 | + AV_COPY64(table+val, &info); | |
| 453 | 453 | levelcnt[curlevel-1]++; |
| 454 | 454 | } |
| 455 | 455 | |
| @@ -503,7 +503,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, · 47 unmodified lines | ||
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | add_level(table, is16bit, nb_codes, numbits, buf, |
| 506 | − 0, 0, FFMIN(maxbits, numbits), 0, minbits, max, count, &info); | |
| 506 | + 0, 0, FFMIN(maxbits, numbits), 0, minbits, max, count, info); | |
| 507 | 507 | |
| 508 | 508 | av_log(logctx, AV_LOG_DEBUG, "Joint: %d/%d/%d/%d/%d codes min=%ubits max=%u\n", |
| 509 | 509 | count[0], count[1], count[2], count[3], count[4], minbits, max); |