Lines Matching refs:pdec
41 static void build_subblock_pattern(struct pwc_dec23_private *pdec) in build_subblock_pattern() argument
62 pdec->table_subblock[i][j] = temp_values[j]; in build_subblock_pattern()
68 static void build_bit_powermask_table(struct pwc_dec23_private *pdec) in build_bit_powermask_table() argument
76 p = pdec->table_bitpowermask[bit]; in build_bit_powermask_table()
142 static void fill_table_dc00_d800(struct pwc_dec23_private *pdec) in fill_table_dc00_d800() argument
151 pdec->table_dc00[i] = offset1 & ~(ONE_HALF); in fill_table_dc00_d800()
152 pdec->table_d800[i] = offset2; in fill_table_dc00_d800()
288 struct pwc_dec23_private *pdec = &pdev->dec23; in pwc_dec23_init() local
290 mutex_init(&pdec->lock); in pwc_dec23_init()
292 if (pdec->last_cmd_valid && pdec->last_cmd == cmd[2]) in pwc_dec23_init()
298 pdec->nbits = 7; /* More bits, mean more bits to encode the stream, but better quality */ in pwc_dec23_init()
300 pdec->nbits = 8; in pwc_dec23_init()
302 pdec->nbits = 6; in pwc_dec23_init()
305 build_table_color(KiaraRomTable[version][0], pdec->table_0004_pass1, pdec->table_8004_pass1); in pwc_dec23_init()
306 build_table_color(KiaraRomTable[version][1], pdec->table_0004_pass2, pdec->table_8004_pass2); in pwc_dec23_init()
312 pdec->nbits = 7; in pwc_dec23_init()
314 pdec->nbits = 8; in pwc_dec23_init()
316 pdec->nbits = 6; in pwc_dec23_init()
319 build_table_color(TimonRomTable[version][0], pdec->table_0004_pass1, pdec->table_8004_pass1); in pwc_dec23_init()
320 build_table_color(TimonRomTable[version][1], pdec->table_0004_pass2, pdec->table_8004_pass2); in pwc_dec23_init()
324 shift = 8 - pdec->nbits; in pwc_dec23_init()
325 pdec->scalebits = SCALEBITS - shift; in pwc_dec23_init()
326 pdec->nbitsmask = 0xFF >> shift; in pwc_dec23_init()
328 fill_table_dc00_d800(pdec); in pwc_dec23_init()
329 build_subblock_pattern(pdec); in pwc_dec23_init()
330 build_bit_powermask_table(pdec); in pwc_dec23_init()
342 pdec->last_cmd = cmd[2]; in pwc_dec23_init()
343 pdec->last_cmd_valid = 1; in pwc_dec23_init()
457 #define fill_nbits(pdec, nbits_wanted) do { \ argument
458 while (pdec->nbits_in_reservoir<(nbits_wanted)) \
460 pdec->reservoir |= (*(pdec->stream)++) << (pdec->nbits_in_reservoir); \
461 pdec->nbits_in_reservoir += 8; \
465 #define skip_nbits(pdec, nbits_to_skip) do { \ argument
466 pdec->reservoir >>= (nbits_to_skip); \
467 pdec->nbits_in_reservoir -= (nbits_to_skip); \
470 #define get_nbits(pdec, nbits_wanted, result) do { \ argument
471 fill_nbits(pdec, nbits_wanted); \
472 result = (pdec->reservoir) & ((1U<<(nbits_wanted))-1); \
473 skip_nbits(pdec, nbits_wanted); \
476 #define __get_nbits(pdec, nbits_wanted, result) do { \ argument
477 result = (pdec->reservoir) & ((1U<<(nbits_wanted))-1); \
478 skip_nbits(pdec, nbits_wanted); \
481 #define look_nbits(pdec, nbits_wanted) \ argument
482 ((pdec->reservoir) & ((1U<<(nbits_wanted))-1))
487 static void decode_block(struct pwc_dec23_private *pdec, in decode_block() argument
495 fill_nbits(pdec, 16); in decode_block()
496 __get_nbits(pdec, pdec->nbits, primary_color); in decode_block()
498 if (look_nbits(pdec,2) == 0) { in decode_block()
499 skip_nbits(pdec, 2); in decode_block()
502 pdec->temp_colors[i] = pdec->table_dc00[primary_color]; in decode_block()
509 pdec->temp_colors[i] = pdec->table_d800[primary_color]; in decode_block()
511 __get_nbits(pdec, 3, channel_v); in decode_block()
529 fill_nbits(pdec, 16); in decode_block()
530 htable_idx = look_nbits(pdec, 6); in decode_block()
534 skip_nbits(pdec, 2); in decode_block()
545 skip_nbits(pdec, 3); in decode_block()
547 __get_nbits(pdec, 4, yyyy); in decode_block()
553 __get_nbits(pdec, nbits+1, col1); in decode_block()
556 mask = pdec->table_bitpowermask[nbits][col1]; in decode_block()
560 block = pdec->table_subblock[rows]; in decode_block()
562 pdec->temp_colors[i] += block[MulIdx[offset1][i]]; in decode_block()
574 block = pdec->table_subblock[rows]; in decode_block()
576 pdec->temp_colors[i] += block[MulIdx[offset1][i]]; in decode_block()
579 skip_nbits(pdec, shift); in decode_block()
586 static void DecompressBand23(struct pwc_dec23_private *pdec, in DecompressBand23() argument
598 pdec->reservoir = 0; in DecompressBand23()
599 pdec->nbits_in_reservoir = 0; in DecompressBand23()
600 pdec->stream = rawyuv + 1; /* The first byte of the stream is skipped */ in DecompressBand23()
602 get_nbits(pdec, 4, compression_index); in DecompressBand23()
607 ptable0004 = pdec->table_0004_pass1[compression_index]; in DecompressBand23()
608 ptable8004 = pdec->table_8004_pass1[compression_index]; in DecompressBand23()
612 decode_block(pdec, ptable0004, ptable8004); in DecompressBand23()
613 copy_image_block_Y(pdec->temp_colors, planar_y, real_image_width, pdec->scalebits); in DecompressBand23()
621 ptable0004 = pdec->table_0004_pass2[compression_index]; in DecompressBand23()
622 ptable8004 = pdec->table_8004_pass2[compression_index]; in DecompressBand23()
626 decode_block(pdec, ptable0004, ptable8004); in DecompressBand23()
627 copy_image_block_CrCb(pdec->temp_colors, planar_u, real_image_width/2, pdec->scalebits); in DecompressBand23()
629 decode_block(pdec, ptable0004, ptable8004); in DecompressBand23()
630 copy_image_block_CrCb(pdec->temp_colors, planar_v, real_image_width/2, pdec->scalebits); in DecompressBand23()
650 struct pwc_dec23_private *pdec = &pdev->dec23; in pwc_dec23_decompress() local
658 mutex_lock(&pdec->lock); in pwc_dec23_decompress()
669 DecompressBand23(pdec, src, in pwc_dec23_decompress()
677 mutex_unlock(&pdec->lock); in pwc_dec23_decompress()