History

avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer

This makes the code more testable as uninitialized fields are 0 and not random values from the last call

Michael Niedermayer committed 3 years ago

Commit a5259f31 parent 85166091 file · +7 −7Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vlc.c+7−7
@@ -424,7 +424,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit, · 423 unmodified lines
424424 uint32_t curcode, int curlen,
425425 int curlimit, int curlevel,
426426 const int minlen, const int max,
427− unsigned* levelcnt, VLC_MULTI_ELEM *info)
427+ unsigned* levelcnt, VLC_MULTI_ELEM info)
428428 {
429429 int max_symbols = VLC_MULTI_MAX_SYMBOLS >> is16bit;
430430 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
440440 code = curcode + (buf[t].code >> curlen);
441441 newlimit = curlimit - l;
442442 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;
445445
446446 if (curlevel) { // let's not add single entries
447447 uint32_t val = code >> (32 - numbits);
448448 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;
451451 for (; val < nb; val++)
452− AV_COPY64(table+val, info);
452+ AV_COPY64(table+val, &info);
453453 levelcnt[curlevel-1]++;
454454 }
455455
@@ -503,7 +503,7 @@ static int vlc_multi_gen(VLC_MULTI_ELEM *table, const VLC *single, · 47 unmodified lines
503503 }
504504
505505 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);
507507
508508 av_log(logctx, AV_LOG_DEBUG, "Joint: %d/%d/%d/%d/%d codes min=%ubits max=%u\n",
509509 count[0], count[1], count[2], count[3], count[4], minbits, max);

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