MCPcopy Create free account
hub / github.com/zhuker/lamejs / huffman_coder_count1

Method huffman_coder_count1

src/main/java/mp3/BitStream.java:415–470  ·  view source on GitHub ↗
(final LameInternalFlags gfc,
			final GrInfo gi)

Source from the content-addressed store, hash-verified

413 }
414
415 private int huffman_coder_count1(final LameInternalFlags gfc,
416 final GrInfo gi) {
417 /* Write count1 area */
418 final HuffCodeTab h = Tables.ht[gi.count1table_select + 32];
419 int i, bits = 0;
420
421 int ix = gi.big_values;
422 int xr = gi.big_values;
423 assert (gi.count1table_select < 2);
424
425 for (i = (gi.count1 - gi.big_values) / 4; i > 0; --i) {
426 int huffbits = 0;
427 int p = 0, v;
428
429 v = gi.l3_enc[ix + 0];
430 if (v != 0) {
431 p += 8;
432 if (gi.xr[xr + 0] < 0)
433 huffbits++;
434 assert (v <= 1);
435 }
436
437 v = gi.l3_enc[ix + 1];
438 if (v != 0) {
439 p += 4;
440 huffbits *= 2;
441 if (gi.xr[xr + 1] < 0)
442 huffbits++;
443 assert (v <= 1);
444 }
445
446 v = gi.l3_enc[ix + 2];
447 if (v != 0) {
448 p += 2;
449 huffbits *= 2;
450 if (gi.xr[xr + 2] < 0)
451 huffbits++;
452 assert (v <= 1);
453 }
454
455 v = gi.l3_enc[ix + 3];
456 if (v != 0) {
457 p++;
458 huffbits *= 2;
459 if (gi.xr[xr + 3] < 0)
460 huffbits++;
461 assert (v <= 1);
462 }
463
464 ix += 4;
465 xr += 4;
466 putbits2(gfc, huffbits + h.table[p], h.hlen[p]);
467 bits += h.hlen[p];
468 }
469 return bits;
470 }
471
472 /**

Callers 1

writeMainDataMethod · 0.95

Calls 1

putbits2Method · 0.95

Tested by

no test coverage detected