summaryrefslogtreecommitdiff
path: root/apps/plugins/bitmaps/native
ModeNameSize
-rw-r--r--SOURCES27500logplain
-rw-r--r--brickmania_ball.11x11x16.bmp450logplain
-rw-r--r--brickmania_ball.15x15x16.bmp774logplain
-rw-r--r--brickmania_ball.3x3x1.bmp108logplain
-rw-r--r--brickmania_ball.4x4x16.bmp102logplain
-rw-r--r--brickmania_ball.4x4x2.bmp112logplain
-rw-r--r--brickmania_ball.5x5x16.bmp134logplain
-rw-r--r--brickmania_ball.5x5x2.bmp138logplain
-rw-r--r--brickmania_ball.7x7x16.bmp222logplain
-rw-r--r--brickmania_break.132x80x16.bmp1062logplain
-rw-r--r--brickmania_break.160x128x16.bmp1736logplain
-rw-r--r--brickmania_break.160x128x2.bmp2614logplain
-rw-r--r--brickmania_break.176x132x16.bmp1876logplain
-rw-r--r--brickmania_break.220x176x16.bmp2616logplain
-rw-r--r--brickmania_break.240x320x16.bmp8622logplain
-rw-r--r--brickmania_break.320x240x16.bmp8120logplain
-rw-r--r--brickmania_break.480x640x16.bmp18198logplain
-rw-r--r--brickmania_break.640x480x16.bmp32310logplain
-rw-r--r--brickmania_bricks.112x64x1.bmp1064logplain
-rw-r--r--brickmania_bricks.128x128x16.bmp1314logplain
-rw-r--r--brickmania_bricks.128x96x2.bmp1316logplain
-rw-r--r--brickmania_bricks.132x80x16.bmp1062logplain
-rw-r--r--brickmania_bricks.138x110x2.bmp2014logplain
-rw-r--r--brickmania_bricks.160x128x16.bmp2408logplain
-rw-r--r--brickmania_bricks.160x128x2.bmp468logplain
-rw-r--r--brickmania_bricks.176x132x16.bmp2604logplain
-rw-r--r--brickmania_bricks.220x176x16.bmp3640logplain
-rw-r--r--brickmania_bricks.240x320x16.bmp8622logplain
-rw-r--r--brickmania_bricks.320x240x16.bmp8120logplain
-rw-r--r--brickmania_bricks.480x640x16.bmp18198logplain
-rw-r--r--brickmania_bricks.640x480x16.bmp32310logplain
-rw-r--r--brickmania_gameover.112x54x16.bmp18198logplain
-rw-r--r--brickmania_gameover.59x30x1.bmp5454logplain
-rw-r--r--brickmania_gameover.86x43x2.bmp11234logplain
-rw-r--r--brickmania_long_pads.112x64x1.bmp278logplain
-rw-r--r--brickmania_long_pads.132x80x16.bmp1134logplain
-rw-r--r--brickmania_long_pads.160x128x16.bmp1974logplain
-rw-r--r--brickmania_long_pads.160x128x2.bmp430logplain
-rw-r--r--brickmania_long_pads.176x132x16.bmp2574logplain
-rw-r--r--brickmania_long_pads.220x176x16.bmp2574logplain
-rw-r--r--brickmania_long_pads.240x320x16.bmp5022logplain
-rw-r--r--brickmania_long_pads.320x240x16.bmp5010logplain
-rw-r--r--brickmania_long_pads.480x640x16.bmp11446logplain
-rw-r--r--brickmania_long_pads.640x480x16.bmp19878logplain
-rw-r--r--brickmania_pads.112x64x1.bmp220logplain
-rw-r--r--brickmania_pads.132x80x16.bmp810logplain
-rw-r--r--brickmania_pads.160x128x16.bmp1436logplain
-rw-r--r--brickmania_pads.160x128x2.bmp316logplain
-rw-r--r--brickmania_pads.176x132x16.bmp1856logplain
-rw-r--r--brickmania_pads.220x176x16.bmp1856logplain
-rw-r--r--brickmania_pads.240x320x16.bmp3618logplain
-rw-r--r--brickmania_pads.320x240x16.bmp3584logplain
-rw-r--r--brickmania_pads.480x640x16.bmp8118logplain
-rw-r--r--brickmania_pads.640x480x16.bmp14166logplain
-rw-r--r--brickmania_powerups.112x64x1.bmp282logplain
-rw-r--r--brickmania_powerups.132x80x16.bmp954logplain
-rw-r--r--brickmania_powerups.160x128x16.bmp1782logplain
-rw-r--r--brickmania_powerups.160x128x2.bmp506logplain
-rw-r--r--brickmania_powerups.176x132x16.bmp1782logplain
-rw-r--r--brickmania_powerups.220x176x16.bmp1782logplain
-rw-r--r--brickmania_powerups.240x320x16.bmp3618logplain
-rw-r--r--brickmania_powerups.320x240x16.bmp4374logplain
-rw-r--r--brickmania_powerups.480x640x16.bmp9774logplain
-rw-r--r--brickmania_powerups.640x480x16.bmp17334logplain
-rw-r--r--brickmania_short_pads.112x64x1.bmp170logplain
-rw-r--r--brickmania_short_pads.132x80x16.bmp522logplain
-rw-r--r--brickmania_short_pads.160x128x16.bmp954logplain
-rw-r--r--brickmania_short_pads.160x128x2.bmp298logplain
-rw-r--r--brickmania_short_pads.176x132x16.bmp1314logplain
-rw-r--r--brickmania_short_pads.220x176x16.bmp1314logplain
-rw-r--r--brickmania_short_pads.240x320x16.bmp2538logplain
-rw-r--r--brickmania_short_pads.320x240x16.bmp2574logplain
-rw-r--r--brickmania_short_pads.480x640x16.bmp5814logplain
-rw-r--r--brickmania_short_pads.640x480x16.bmp9966logplain
-rw-r--r--bubbles_background.128x128x16.bmp49206logplain
-rw-r--r--bubbles_background.128x128x2.bmp49206logplain
-rw-r--r--bubbles_background.128x160x16.bmp61496logplain
-rw-r--r--bubbles_background.128x96x16.bmp36918logplain
-rw-r--r--bubbles_background.132x80x16.bmp31734logplain
-rw-r--r--bubbles_background.160x128x16.bmp61494logplain
-rw-r--r--bubbles_background.176x132x16.bmp69750logplain
-rw-r--r--bubbles_background.176x220x16.bmp116214logplain
-rw-r--r--bubbles_background.220x176x16.bmp116214logplain
-rw-r--r--bubbles_background.240x320x16.bmp230454logplain
-rw-r--r--bubbles_background.320x240x16.bmp230454logplain
-rw-r--r--bubbles_background.640x480x16.bmp921654logplain
-rw-r--r--bubbles_emblem.112x64x1.bmp222logplain
-rw-r--r--bubbles_emblem.128x96x2.bmp344logplain
-rw-r--r--bubbles_emblem.132x80x16.bmp1014logplain
-rw-r--r--bubbles_emblem.138x110x2.bmp1014logplain
-rw-r--r--bubbles_emblem.160x128x16.bmp1590logplain
-rw-r--r--bubbles_emblem.160x128x2.bmp1590logplain
-rw-r--r--bubbles_emblem.220x176x16.bmp3510logplain
-rw-r--r--bubbles_emblem.320x240x16.bmp6198logplain
-rw-r--r--bubbles_emblem.640x480x16.bmp24630logplain
-rw-r--r--card_back.13x13x1.bmp114logplain
-rw-r--r--card_back.15x20x16.bmp1014logplain
-rw-r--r--card_back.15x20x2.bmp392logplain
-rw-r--r--card_back.18x23x1.bmp154logplain
-rw-r--r--card_back.18x23x16.bmp1342logplain
-rw-r--r--card_back.18x23x2.bmp532logplain
-rw-r--r--card_back.26x33x16.bmp2694logplain
-rw-r--r--card_back.37x49x16.bmp5542logplain
-rw-r--r--card_back.55x73x16.bmp12318logplain
-rw-r--r--card_back.74x98x16.bmp22006logplain
-rw-r--r--card_deck.169x52x1.bmp1310logplain
-rw-r--r--card_deck.195x80x16.bmp47094logplain
-rw-r--r--card_deck.195x80x2.bmp15752logplain
-rw-r--r--card_deck.234x92x1.bmp3006logplain
-rw-r--r--card_deck.234x92x16.bmp64822logplain
-rw-r--r--card_deck.234x92x2.bmp21784logplain
-rw-r--r--card_deck.338x132x16.bmp134166logplain
-rw-r--r--card_deck.481x196x16.bmp283078logplain
-rw-r--r--card_deck.715x291x16.bmp625122logplain
-rw-r--r--card_deck.962x392x16.bmp1132150logplain
-rw-r--r--chessbox_pieces.104x104x2.bmp5476logplain
-rw-r--r--chessbox_pieces.128x128x1.bmp1726logplain
-rw-r--r--chessbox_pieces.128x128x2.bmp7734logplain
-rw-r--r--chessbox_pieces.176x176x16.bmp38950logplain
-rw-r--r--chessbox_pieces.240x240x16.bmp25526logplain
-rw-r--r--chessbox_pieces.480x480x16.bmp94166logplain
-rw-r--r--chessbox_pieces.64x64x1.bmp894logplain
-rw-r--r--chessbox_pieces.80x64x1.bmp894logplain
-rw-r--r--chessbox_pieces.80x80x16.bmp8374logplain
-rw-r--r--chessbox_pieces.96x96x2.bmp2564logplain
-rw-r--r--clock_binary.112x64x1.bmp1974logplain
-rw-r--r--clock_binary.128x128x16.bmp3414logplain
-rw-r--r--clock_binary.128x128x2.bmp3414logplain
-rw-r--r--clock_binary.132x80x16.bmp2854logplain
-rw-r--r--clock_binary.138x110x2.bmp2614logplain
-rw-r--r--clock_binary.160x128x16.bmp5374logplain
-rw-r--r--clock_binary.160x128x2.bmp3038logplain
-rw-r--r--clock_binary.220x176x16.bmp10638logplain
-rw-r--r--clock_binary.320x240x16.bmp21334logplain
-rw-r--r--clock_digits.112x64x1.bmp1102logplain
-rw-r--r--clock_digits.128x128x16.bmp21894logplain
-rw-r--r--clock_digits.128x128x2.bmp21894logplain
-rw-r--r--clock_digits.132x80x16.bmp14406logplain
-rw-r--r--clock_digits.138x110x2.bmp11062logplain
-rw-r--r--clock_digits.160x128x16.bmp34634logplain
-rw-r--r--clock_digits.160x128x2.bmp13818logplain
-rw-r--r--clock_digits.220x176x16.bmp68850logplain
-rw-r--r--clock_digits.320x240x16.bmp138374logplain
-rw-r--r--clock_logo.112x64x1.bmp864logplain
-rw-r--r--clock_logo.128x128x16.bmp24632logplain
-rw-r--r--clock_logo.128x128x2.bmp24632logplain
-rw-r--r--clock_logo.132x80x16.bmp26190logplain
-rw-r--r--clock_logo.138x110x2.bmp10740logplain
-rw-r--r--clock_logo.160x128x16.bmp38456logplain
-rw-r--r--clock_logo.160x128x2.bmp13880logplain
-rw-r--r--clock_logo.176x132x16.bmp46520logplain
-rw-r--r--clock_logo.220x176x16.bmp72656logplain
-rw-r--r--clock_logo.320x240x16.bmp153656logplain
-rw-r--r--clock_messages.112x64x1.bmp1408logplain
-rw-r--r--clock_messages.128x128x16.bmp36920logplain
-rw-r--r--clock_messages.128x128x2.bmp36920logplain
-rw-r--r--clock_messages.132x80x16.bmp33318logplain
-rw-r--r--clock_messages.138x110x2.bmp15360logplain
-rw-r--r--clock_messages.160x128x16.bmp57656logplain
-rw-r--r--clock_messages.160x128x2.bmp20280logplain
-rw-r--r--clock_messages.176x132x16.bmp69752logplain
-rw-r--r--clock_messages.220x176x16.bmp106976logplain
-rw-r--r--clock_messages.320x240x16.bmp230456logplain
-rw-r--r--clock_segments.112x64x1.bmp1102logplain
-rw-r--r--clock_segments.128x128x16.bmp21896logplain
-rw-r--r--clock_segments.128x128x2.bmp21896logplain
-rw-r--r--clock_segments.132x80x16.bmp14406logplain
-rw-r--r--clock_segments.138x110x2.bmp11064logplain
-rw-r--r--clock_segments.160x128x16.bmp34636logplain
-rw-r--r--clock_segments.160x128x2.bmp13820logplain
-rw-r--r--clock_segments.220x176x16.bmp68852logplain
-rw-r--r--clock_segments.320x240x16.bmp138376logplain
-rw-r--r--clock_smalldigits.112x64x1.bmp582logplain
-rw-r--r--clock_smalldigits.128x128x16.bmp5880logplain
-rw-r--r--clock_smalldigits.128x128x2.bmp5880logplain
-rw-r--r--clock_smalldigits.132x80x16.bmp4786logplain
-rw-r--r--clock_smalldigits.160x128x16.bmp5880logplain
-rw-r--r--clock_smalldigits.160x128x2.bmp3264logplain
-rw-r--r--clock_smalldigits.220x176x16.bmp5880logplain
-rw-r--r--clock_smalldigits.320x240x16.bmp13160logplain
-rw-r--r--clock_smallsegments.112x64x1.bmp686logplain
-rw-r--r--clock_smallsegments.128x128x16.bmp5880logplain
-rw-r--r--clock_smallsegments.128x128x2.bmp5880logplain
-rw-r--r--clock_smallsegments.132x80x16.bmp4786logplain
-rw-r--r--clock_smallsegments.160x128x16.bmp5880logplain
-rw-r--r--clock_smallsegments.160x128x2.bmp3264logplain
-rw-r--r--clock_smallsegments.220x176x16.bmp5880logplain
-rw-r--r--clock_smallsegments.320x240x16.bmp13160logplain
-rw-r--r--fft_colors.16.bmp822logplain
-rw-r--r--flipit_cursor.112x112x16.bmp50230logplain
-rw-r--r--flipit_cursor.17x17x16.bmp938logplain
-rw-r--r--flipit_cursor.25x25x16.bmp1954logplain
-rw-r--r--flipit_cursor.28x28x16.bmp2406logplain
-rw-r--r--flipit_cursor.40x40x16.bmp4854logplain
-rw-r--r--flipit_cursor.56x56x16.bmp9462logplain
-rw-r--r--flipit_tokens.112x224x16.bmp100406logplain
-rw-r--r--flipit_tokens.16x26x1.bmp1302logplain
-rw-r--r--flipit_tokens.17x34x16.bmp1822logplain
-rw-r--r--flipit_tokens.21x42x2.bmp1080logplain
-rw-r--r--flipit_tokens.25x50x16.bmp3854logplain
-rw-r--r--flipit_tokens.25x50x2.bmp2478logplain
-rw-r--r--flipit_tokens.28x56x1.bmp286logplain
-rw-r--r--flipit_tokens.28x56x16.bmp4758logplain
-rw-r--r--flipit_tokens.28x56x2.bmp1638logplain
-rw-r--r--flipit_tokens.40x80x16.bmp9654logplain
-rw-r--r--flipit_tokens.56x112x16.bmp18870logplain
-rw-r--r--invadrox_alien_explode.10x5x16.bmp130logplain
-rw-r--r--invadrox_alien_explode.13x7x16.bmp182logplain
-rw-r--r--invadrox_alien_explode.37x20x16.bmp2294logplain
-rw-r--r--invadrox_aliens.16x15x16.bmp310logplain
-rw-r--r--invadrox_aliens.24x24x16.bmp646logplain
-rw-r--r--invadrox_aliens.68x68x16.bmp13926logplain
-rw-r--r--invadrox_background.160x128x16.bmp61494logplain
-rw-r--r--invadrox_background.176x132x16.bmp69750logplain
-rw-r--r--invadrox_background.176x220x16.bmp116214logplain
-rw-r--r--invadrox_background.220x176x16.bmp116214logplain
-rw-r--r--invadrox_background.240x320x16.bmp230454logplain
-rw-r--r--invadrox_background.320x240x16.bmp230454logplain
-rw-r--r--invadrox_background.480x640x16.bmp921654logplain
-rw-r--r--invadrox_background.640x480x16.bmp921654logplain
-rw-r--r--invadrox_bombs.27x126x16.bmp10638logplain
-rw-r--r--invadrox_bombs.9x30x16.bmp430logplain
-rw-r--r--invadrox_bombs.9x42x16.bmp574logplain
-rw-r--r--invadrox_numbers.140x19x16.bmp8034logplain
-rw-r--r--invadrox_numbers.40x5x16.bmp270logplain
-rw-r--r--invadrox_numbers.50x7x16.bmp434logplain
-rw-r--r--invadrox_shield.15x10x16.bmp230logplain
-rw-r--r--invadrox_shield.15x10x2.bmp1238logplain
-rw-r--r--invadrox_shield.22x16x16.bmp454logplain
-rw-r--r--invadrox_shield.64x47x16.bmp9078logplain
-rw-r--r--invadrox_ships.10x15x16.bmp250logplain
-rw-r--r--invadrox_ships.10x15x2.bmp1258logplain
-rw-r--r--invadrox_ships.16x24x16.bmp454logplain
-rw-r--r--invadrox_ships.46x69x16.bmp9714logplain
-rw-r--r--invadrox_ufo.11x5x16.bmp130logplain
-rw-r--r--invadrox_ufo.11x5x2.bmp1138logplain
-rw-r--r--invadrox_ufo.16x7x16.bmp182logplain
-rw-r--r--invadrox_ufo.46x20x16.bmp2854logplain
-rw-r--r--invadrox_ufo_explode.14x5x16.bmp150logplain
-rw-r--r--invadrox_ufo_explode.14x5x2.bmp1158logplain
-rw-r--r--invadrox_ufo_explode.21x8x16.bmp262logplain
-rw-r--r--invadrox_ufo_explode.61x23x16.bmp4286logplain
-rw-r--r--jackpot_slots.30x420x1.bmp1742logplain
-rw-r--r--jewels.112x64x1.bmp798logplain
-rw-r--r--jewels.128x128x16.bmp14222logplain
-rw-r--r--jewels.128x128x2.bmp14222logplain
-rw-r--r--jewels.128x96x2.bmp4392logplain
-rw-r--r--jewels.132x80x16.bmp7414logplain
-rw-r--r--jewels.138x110x2.bmp5862logplain
-rw-r--r--jewels.160x128x16.bmp17718logplain
-rw-r--r--jewels.160x128x2.bmp6966logplain
-rw-r--r--jewels.220x176x16.bmp34462logplain
-rw-r--r--jewels.320x240x16.bmp63534logplain
-rw-r--r--jewels.640x480x16.bmp248454logplain
-rw-r--r--matrix_bold.bmp17694logplain
-rw-r--r--matrix_normal.bmp17694logplain
-rw-r--r--minesweeper_tiles.10x10x24.bmp4854logplain
-rw-r--r--minesweeper_tiles.12x12x2.bmp3238logplain
-rw-r--r--minesweeper_tiles.12x12x24.bmp6534logplain
-rw-r--r--minesweeper_tiles.16x16x24.bmp11574logplain
-rw-r--r--minesweeper_tiles.8x8x1.bmp2934logplain
-rw-r--r--pegbox_header.112x8x1.bmp190logplain
-rw-r--r--pegbox_header.128x16x2.bmp2118logplain
-rw-r--r--pegbox_header.128x42x16.bmp16182logplain
-rw-r--r--pegbox_header.138x26x2.bmp3710logplain
-rw-r--r--pegbox_header.160x24x1.bmp542logplain
-rw-r--r--pegbox_header.160x24x16.bmp7736logplain
-rw-r--r--pegbox_header.160x24x2.bmp3910logplain
-rw-r--r--pegbox_header.176x28x16.bmp9912logplain
-rw-r--r--pegbox_header.20x64x1.bmp318logplain
-rw-r--r--pegbox_header.220x40x16.bmp17656logplain
-rw-r--r--pegbox_header.22x80x16.bmp5494logplain
-rw-r--r--pegbox_header.240x40x16.bmp19256logplain
-rw-r--r--pegbox_header.320x40x16.bmp25656logplain
-rw-r--r--pegbox_header.640x80x16.bmp153654logplain
-rw-r--r--pegbox_pieces.10x10x16.bmp2294logplain
-rw-r--r--pegbox_pieces.10x10x2.bmp910logplain
-rw-r--r--pegbox_pieces.12x12x1.bmp398logplain
-rw-r--r--pegbox_pieces.12x12x16.bmp2072logplain
-rw-r--r--pegbox_pieces.12x12x2.bmp1078logplain
-rw-r--r--pegbox_pieces.16x16x16.bmp3640logplain
-rw-r--r--pegbox_pieces.24x24x16.bmp8120logplain
-rw-r--r--pegbox_pieces.48x48x16.bmp48438logplain
-rw-r--r--pegbox_pieces.9x7x1.bmp258logplain
-rw-r--r--pegbox_pieces.9x9x16.bmp1818logplain
-rw-r--r--pictureflow_emptyslide.100x100x16.bmp11078logplain
-rw-r--r--pictureflow_emptyslide.50x50x16.bmp3678logplain
-rw-r--r--pictureflow_logo.100x18x16.bmp5454logplain
-rw-r--r--pictureflow_logo.193x34x16.bmp19776logplain
-rw-r--r--pitch_notes.128x128x16.bmp64856logplain
-rw-r--r--pitch_notes.128x128x2.bmp64856logplain
-rw-r--r--pitch_notes.128x64x1.bmp10294logplain
-rw-r--r--pitch_notes.128x96x2.bmp14472logplain
-rw-r--r--pitch_notes.132x80x16.bmp26552logplain
-rw-r--r--pitch_notes.160x128x16.bmp64856logplain
-rw-r--r--pitch_notes.160x128x2.bmp21672logplain
-rw-r--r--pitch_notes.176x132x16.bmp64856logplain
-rw-r--r--pitch_notes.176x220x16.bmp204176logplain
-rw-r--r--pitch_notes.220x176x16.bmp121016logplain
-rw-r--r--pitch_notes.320x240x16.bmp248456logplain
-rw-r--r--resistor.128x128x16.bmp16182logplain
-rw-r--r--resistor.160x128x16.bmp25494logplain
-rw-r--r--resistor.176x220x16.bmp28726logplain
-rw-r--r--resistor.220x176x16.bmp43614logplain
-rw-r--r--resistor.240x400x16.bmp56934logplain
-rw-r--r--resistor.320x240x16.bmp100854logplain
-rw-r--r--resistor.68x20x16.bmp4134logplain
-rw-r--r--rockblox_background.112x64x1.bmp1086logplain
-rw-r--r--rockblox_background.128x128x16.bmp49206logplain
-rw-r--r--rockblox_background.128x128x2.bmp49206logplain
-rw-r--r--rockblox_background.128x160x16.bmp61496logplain
-rw-r--r--rockblox_background.128x64x1.bmp1086logplain
-rw-r--r--rockblox_background.128x96x16.bmp13366logplain
-rw-r--r--rockblox_background.128x96x2.bmp12360logplain
-rw-r--r--rockblox_background.132x80x16.bmp31734logplain
-rw-r--r--rockblox_background.138x110x2.bmp15472logplain
-rw-r--r--rockblox_background.160x128x1.bmp2622logplain
-rw-r--r--rockblox_background.160x128x16.bmp61496logplain
-rw-r--r--rockblox_background.160x128x2.bmp21560logplain
-rw-r--r--rockblox_background.176x132x16.bmp69752logplain
-rw-r--r--rockblox_background.176x220x16.bmp154934logplain
-rw-r--r--rockblox_background.220x176x16.bmp116216logplain
-rw-r--r--rockblox_background.240x320x16.bmp230454logplain
-rw-r--r--rockblox_background.320x240x16.bmp230456logplain
-rw-r--r--rockblox_background.640x480x16.bmp921654logplain
-rw-r--r--rockboxlogo.112x30x1.bmp542logplain
-rw-r--r--rockboxlogo.128x40x16.bmp10294logplain
-rw-r--r--rockboxlogo.138x46x2.bmp3392logplain
-rw-r--r--rockboxlogo.220x68x16.bmp44934logplain
-rw-r--r--rockboxlogo.90x28x16.bmp7670logplain
-rw-r--r--rockboxlogo.91x32x1.bmp446logplain
-rw-r--r--rockboxlogo.91x32x2.bmp1566logplain
-rw-r--r--rockpaint.8x8x24.bmp3726logplain
-rw-r--r--rockpaint_hsvrgb.8x10x24.bmp2934logplain
-rw-r--r--sliding_puzzle.108x108x16.bmp35046logplain
-rw-r--r--sliding_puzzle.108x108x2.bmp11734logplain
-rw-r--r--sliding_puzzle.128x128x16.bmp49206logplain
-rw-r--r--sliding_puzzle.128x128x2.bmp16454logplain
-rw-r--r--sliding_puzzle.132x132x16.bmp52326logplain
-rw-r--r--sliding_puzzle.176x176x16.bmp92982logplain
-rw-r--r--sliding_puzzle.240x240x16.bmp172854logplain
-rw-r--r--sliding_puzzle.480x480x16.bmp691254logplain
-rw-r--r--sliding_puzzle.80x64x1.bmp830logplain
-rw-r--r--sliding_puzzle.80x80x16.bmp19254logplain
-rw-r--r--sliding_puzzle.96x96x2.bmp4728logplain
-rw-r--r--sliding_puzzle.bmp480054logplain
-rw-r--r--snake2_bottom.160x128x16.bmp4856logplain
-rw-r--r--snake2_bottom.160x128x2.bmp918logplain
-rw-r--r--snake2_bottom.176x132x16.bmp5336logplain
-rw-r--r--snake2_bottom.220x176x16.bmp6654logplain
-rw-r--r--snake2_bottom.240x320x16.bmp7256logplain
-rw-r--r--snake2_bottom.320x240x16.bmp9656logplain
-rw-r--r--snake2_bottom.640x480x16.bmp38454logplain
-rw-r--r--snake2_header1.160x128x16.bmp18296logplain
-rw-r--r--snake2_header1.160x128x2.bmp3158logplain
-rw-r--r--snake2_header1.176x132x16.bmp20120logplain
-rw-r--r--snake2_header1.220x176x16.bmp25136logplain
-rw-r--r--snake2_header1.240x320x16.bmp27416logplain
-rw-r--r--snake2_header1.320x240x16.bmp36536logplain
-rw-r--r--snake2_header1.640x480x16.bmp145974logplain
-rw-r--r--snake2_header2.160x128x16.bmp18296logplain
-rw-r--r--snake2_header2.160x128x2.bmp3158logplain
-rw-r--r--snake2_header2.176x132x16.bmp20120logplain
-rw-r--r--snake2_header2.220x176x16.bmp25136logplain
-rw-r--r--snake2_header2.240x320x16.bmp27416logplain
-rw-r--r--snake2_header2.320x240x16.bmp36536logplain
-rw-r--r--snake2_header2.640x480x16.bmp145974logplain
-rw-r--r--snake2_left.160x128x16.bmp2616logplain
-rw-r--r--snake2_left.160x128x2.bmp758logplain
-rw-r--r--snake2_left.176x132x16.bmp2744logplain
-rw-r--r--snake2_left.220x176x16.bmp4150logplain
-rw-r--r--snake2_left.240x320x16.bmp3894logplain
-rw-r--r--snake2_left.320x240x16.bmp6200logplain
-rw-r--r--snake2_left.640x480x16.bmp23094logplain
-rw-r--r--snake2_right.160x128x16.bmp2616logplain
-rw-r--r--snake2_right.160x128x2.bmp758logplain
-rw-r--r--snake2_right.176x132x16.bmp2744logplain
-rw-r--r--snake2_right.220x176x16.bmp4150logplain
-rw-r--r--snake2_right.240x320x16.bmp3894logplain
-rw-r--r--snake2_right.320x240x16.bmp6200logplain
-rw-r--r--snake2_right.640x480x16.bmp23094logplain
-rw-r--r--sokoban_tiles.12x12x16.bmp3078logplain
-rw-r--r--sokoban_tiles.14x14x16.bmp4366logplain
-rw-r--r--sokoban_tiles.28x28x16.bmp22006logplain
-rw-r--r--sokoban_tiles.4x4x1.bmp174logplain
-rw-r--r--sokoban_tiles.5x5x16.bmp614logplain
-rw-r--r--sokoban_tiles.5x5x2.bmp350logplain
-rw-r--r--sokoban_tiles.6x6x1.bmp230logplain
-rw-r--r--sokoban_tiles.6x6x16.bmp894logplain
-rw-r--r--sokoban_tiles.6x6x2.bmp406logplain
-rw-r--r--sokoban_tiles.7x7x16.bmp1230logplain
-rw-r--r--sokoban_tiles.9x9x16.bmp1818logplain
-rw-r--r--solitaire_suitsi.13x52x1.bmp270logplain
-rw-r--r--solitaire_suitsi.15x80x16.bmp3894logplain
-rw-r--r--solitaire_suitsi.15x80x2.bmp1350logplain
-rw-r--r--solitaire_suitsi.18x92x1.bmp430logplain
-rw-r--r--solitaire_suitsi.18x92x16.bmp5206logplain
-rw-r--r--solitaire_suitsi.18x92x2.bmp1914logplain
-rw-r--r--solitaire_suitsi.26x132x16.bmp10614logplain
-rw-r--r--solitaire_suitsi.37x196x16.bmp22006logplain
-rw-r--r--solitaire_suitsi.55x291x16.bmp48942logplain
-rw-r--r--solitaire_suitsi.74x392x16.bmp87862logplain
-rw-r--r--star_tiles.10x10.bmp1654logplain
-rw-r--r--star_tiles.10x10x2.bmp1678logplain
-rw-r--r--star_tiles.11x11.bmp2034logplain
-rw-r--r--star_tiles.13x13.bmp2654logplain
-rw-r--r--star_tiles.15x15.bmp3654logplain
-rw-r--r--star_tiles.20x20.bmp6054logplain
-rw-r--r--star_tiles.40x40.bmp24054logplain
-rw-r--r--star_tiles.6x7x1.bmp184logplain
-rw-r--r--star_tiles.8x8.bmp1014logplain
-rw-r--r--star_tiles.8x8x2.bmp390logplain
-rw-r--r--sudoku_inverse.112x64x1.bmp302logplain
-rw-r--r--sudoku_inverse.128x128x16.bmp1302logplain
-rw-r--r--sudoku_inverse.128x128x2.bmp3080logplain
-rw-r--r--sudoku_inverse.128x96x2.bmp424logplain
-rw-r--r--sudoku_inverse.132x80x16.bmp742logplain
-rw-r--r--sudoku_inverse.138x110x2.bmp462logplain
-rw-r--r--sudoku_inverse.160x128x1.bmp542logplain
-rw-r--r--sudoku_inverse.160x128x16.bmp1542logplain
-rw-r--r--sudoku_inverse.160x128x2.bmp1030logplain
-rw-r--r--sudoku_inverse.220x176x16.bmp15414logplain
-rw-r--r--sudoku_inverse.320x240x16.bmp34614logplain
-rw-r--r--sudoku_inverse.640x480x16.bmp138294logplain
-rw-r--r--sudoku_normal.112x64x1.bmp302logplain
-rw-r--r--sudoku_normal.128x128x16.bmp1302logplain
-rw-r--r--sudoku_normal.128x128x2.bmp6056logplain
-rw-r--r--sudoku_normal.128x96x2.bmp424logplain
-rw-r--r--sudoku_normal.132x80x16.bmp734logplain
-rw-r--r--sudoku_normal.138x110x2.bmp462logplain
-rw-r--r--sudoku_normal.160x128x1.bmp542logplain
-rw-r--r--sudoku_normal.160x128x16.bmp1542logplain
-rw-r--r--sudoku_normal.160x128x2.bmp1030logplain
-rw-r--r--sudoku_normal.220x176x16.bmp15414logplain
-rw-r--r--sudoku_normal.320x240x16.bmp34614logplain
-rw-r--r--sudoku_normal.640x480x16.bmp138294logplain
-rw-r--r--sudoku_start.112x64x1.bmp302logplain
-rw-r--r--sudoku_start.128x128x16.bmp1302logplain
-rw-r--r--sudoku_start.128x128x2.bmp6056logplain
-rw-r--r--sudoku_start.128x96x2.bmp840logplain
-rw-r--r--sudoku_start.132x80x16.bmp742logplain
-rw-r--r--sudoku_start.138x110x2.bmp1266logplain
-rw-r--r--sudoku_start.160x128x1.bmp542logplain
-rw-r--r--sudoku_start.160x128x16.bmp1542logplain
-rw-r--r--sudoku_start.160x128x2.bmp1030logplain
-rw-r--r--sudoku_start.220x176x16.bmp15414logplain
-rw-r--r--sudoku_start.320x240x16.bmp34614logplain
-rw-r--r--sudoku_start.640x480x16.bmp138294logplain
-rw-r--r--superdom_boarditems.176x132x16.bmp630logplain
-rw-r--r--superdom_boarditems.220x176x16.bmp1902logplain
-rw-r--r--superdom_boarditems.240x320x16.bmp3078logplain
-rw-r--r--superdom_boarditems.320x240x16.bmp3654logplain
-rw-r--r--superdom_boarditems.480x640x16.bmp11718logplain
-rw-r--r--superdom_boarditems.640x480x16.bmp14454logplain
class="hl opt">,9,10,10,11,10,11,8,7,7,8,9,10,10,10,8,7,8,9,10,10,10,10}; static const uint8_t t12l[64] = {4,3,5,7,8,9,9,9,3,3,4,5,7,7,8,8,5,4,5,6,7,8,7,8,6,5,6,6,7,8,8,8,7,6,7,7,8, 8,8,9,8,7,8,8,8,9,8,9,8,7,7,8,8,9,9,10,9,8,8,9,9,9,9,10}; static const uint8_t t13l[256] = {1,4,6,7,8,9,9,10,9,10,11,11,12,12,13,13,3,4,6,7,8,8,9,9,9,9,10,10,11,12,12,12, 6,6,7,8,9,9,10,10,9,10,10,11,11,12,13,13,7,7,8,9,9,10,10,10,10,11,11,11,11,12, 13,13,8,7,9,9,10,10,11,11,10,11,11,12,12,13,13,14,9,8,9,10,10,10,11,11,11,11, 12,11,13,13,14,14,9,9,10,10,11,11,11,11,11,12,12,12,13,13,14,14,10,9,10,11,11, 11,12,12,12,12,13,13,13,14,16,16,9,8,9,10,10,11,11,12,12,12,12,13,13,14,15,15, 10,9,10,10,11,11,11,13,12,13,13,14,14,14,16,15,10,10,10,11,11,12,12,13,12,13, 14,13,14,15,16,17,11,10,10,11,12,12,12,12,13,13,13,14,15,15,15,16,11,11,11,12, 12,13,12,13,14,14,15,15,15,16,16,16,12,11,12,13,13,13,14,14,14,14,14,15,16,15, 16,16,13,12,12,13,13,13,15,14,14,17,15,15,15,17,16,16,12,12,13,14,14,14,15,14, 15,15,16,16,19,18,19,16}; static const uint8_t t15l[256] = {3,4,5,7,7,8,9,9,9,10,10,11,11,11,12,13,4,3,5,6,7,7,8,8,8,9,9,10,10,10,11,11,5, 5,5,6,7,7,8,8,8,9,9,10,10,11,11,11,6,6,6,7,7,8,8,9,9,9,10,10,10,11,11,11,7,6, 7,7,8,8,9,9,9,9,10,10,10,11,11,11,8,7,7,8,8,8,9,9,9,9,10,10,11,11,11,12,9,7,8, 8,8,9,9,9,9,10,10,10,11,11,12,12,9,8,8,9,9,9,9,10,10,10,10,10,11,11,11,12,9,8, 8,9,9,9,9,10,10,10,10,11,11,12,12,12,9,8,9,9,9,9,10,10,10,11,11,11,11,12,12, 12,10,9,9,9,10,10,10,10,10,11,11,11,11,12,13,12,10,9,9,9,10,10,10,10,11,11,11, 11,12,12,12,13,11,10,9,10,10,10,11,11,11,11,11,11,12,12,13,13,11,10,10,10,10, 11,11,11,11,12,12,12,12,12,13,13,12,11,11,11,11,11,11,11,12,12,12,12,13,13,12, 13,12,11,11,11,11,11,11,12,12,12,12,12,13,13,13,13}; static const uint8_t t16l[256] = {1,4,6,8,9,9,10,10,11,11,11,12,12,12,13,9,3,4,6,7,8,9,9,9,10,10,10,11,12,11,12, 8,6,6,7,8,9,9,10,10,11,10,11,11,11,12,12,9,8,7,8,9,9,10,10,10,11,11,12,12,12, 13,13,10,9,8,9,9,10,10,11,11,11,12,12,12,13,13,13,9,9,8,9,9,10,11,11,12,11,12, 12,13,13,13,14,10,10,9,9,10,11,11,11,11,12,12,12,12,13,13,14,10,10,9,10,10,11, 11,11,12,12,13,13,13,13,15,15,10,10,10,10,11,11,11,12,12,13,13,13,13,14,14,14, 10,11,10,10,11,11,12,12,13,13,13,13,14,13,14,13,11,11,11,10,11,12,12,12,12,13, 14,14,14,15,15,14,10,12,11,11,11,12,12,13,14,14,14,14,14,14,13,14,11,12,12,12, 12,12,13,13,13,13,15,14,14,14,14,16,11,14,12,12,12,13,13,14,14,14,16,15,15,15, 17,15,11,13,13,11,12,14,14,13,14,14,15,16,15,17,15,14,11,9,8,8,9,9,10,10,10, 11,11,11,11,11,11,11,8}; static const uint8_t t24l[256] = {4,4,6,7,8,9,9,10,10,11,11,11,11,11,12,9,4,4,5,6,7,8,8,9,9,9,10,10,10,10,10,8, 6,5,6,7,7,8,8,9,9,9,9,10,10,10,11,7,7,6,7,7,8,8,8,9,9,9,9,10,10,10,10,7,8,7,7, 8,8,8,8,9,9,9,10,10,10,10,11,7,9,7,8,8,8,8,9,9,9,9,10,10,10,10,10,7,9,8,8,8,8, 9,9,9,9,10,10,10,10,10,11,7,10,8,8,8,9,9,9,9,10,10,10,10,10,11,11,8,10,9,9,9, 9,9,9,9,9,10,10,10,10,11,11,8,10,9,9,9,9,9,9,10,10,10,10,10,11,11,11,8,11,9,9, 9,9,10,10,10,10,10,10,11,11,11,11,8,11,10,9,9,9,10,10,10,10,10,10,11,11,11,11, 8,11,10,10,10,10,10,10,10,10,10,11,11,11,11,11,8,11,10,10,10,10,10,10,10,11, 11,11,11,11,11,11,8,12,10,10,10,10,10,10,11,11,11,11,11,11,11,11,8,8,7,7,7,7, 7,7,7,7,7,7,8,8,8,8,4}; static struct huffcodetab ht[HTN] = { { 0, NULL, NULL}, /* Apparently not used */ { 2, t1HB, t1l}, { 3, t2HB, t2l}, { 3, t3HB, t3l}, { 0, NULL, NULL}, /* Apparently not used */ { 4, t5HB, t5l}, { 4, t6HB, t6l}, { 6, t7HB, t7l}, { 6, t8HB, t8l}, { 6, t9HB, t9l}, { 8, t10HB, t10l}, { 8, t11HB, t11l}, { 8, t12HB, t12l}, {16, t13HB, t13l}, { 0, NULL, NULL}, /* Apparently not used */ {16, t15HB, t15l} }; static const struct huffcodebig ht_big[HTN] = { { 16, 1, 1 }, { 16, 2, 3 }, { 16, 3, 7 }, { 16, 4, 15 }, { 16, 6, 63 }, { 16, 8, 255 }, { 16, 10, 1023 }, { 16, 13, 8191 }, { 16, 4, 15 }, { 16, 5, 31 }, { 16, 6, 63 }, { 16, 7, 127 }, { 16, 8, 255 }, { 16, 9, 511 }, { 16, 11, 2047 }, { 16, 13, 8191 } }; static const struct { const uint8_t region0_cnt; const uint8_t region1_cnt; } subdv_table[23] = { {0, 0}, /* 0 bands */ {0, 0}, /* 1 bands */ {0, 0}, /* 2 bands */ {0, 0}, /* 3 bands */ {0, 0}, /* 4 bands */ {0, 1}, /* 5 bands */ {1, 1}, /* 6 bands */ {1, 1}, /* 7 bands */ {1, 2}, /* 8 bands */ {2, 2}, /* 9 bands */ {2, 3}, /* 10 bands */ {2, 3}, /* 11 bands */ {3, 4}, /* 12 bands */ {3, 4}, /* 13 bands */ {3, 4}, /* 14 bands */ {4, 5}, /* 15 bands */ {4, 5}, /* 16 bands */ {4, 6}, /* 17 bands */ {5, 6}, /* 18 bands */ {5, 6}, /* 19 bands */ {5, 7}, /* 20 bands */ {6, 7}, /* 21 bands */ {6, 7}, /* 22 bands */ }; static const uint16_t sfBand[6][23] = { /* Table B.2.b: 22.05 kHz */ {0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576}, /* Table B.2.c: 24 kHz */ {0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,330,394,464,540,576}, /* Table B.2.a: 16 kHz */ {0,6,12,18,24,30,36,44,45,66,80,96,116,140,168,200,238,248,336,396,464,522,576}, /* Table B.8.b: 44.1 kHz */ {0,4, 8,12,16,20,24,30,36,44,52,62, 74, 90,110,134,162,196,238,288,342,418,576}, /* Table B.8.c: 48 kHz */ {0,4, 8,12,16,20,24,30,36,42,50,60, 72, 88,106,128,156,190,230,276,330,384,576}, /* Table B.8.a: 32 kHz */ {0,4, 8,12,16,20,24,30,36,44,54,66, 82,102,126,156,194,240,296,364,448,550,576} }; static const uint16_t int2idx[4096] = /* int2idx[i] = sqrt(i*sqrt(i)); */ { 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 38, 39, 39, 39, 39, 40, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 48, 48, 48, 48, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69, 70, 70, 70, 70, 70, 70, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73, 73, 74, 74, 74, 74, 74, 74, 75, 75, 75, 75, 75, 75, 76, 76, 76, 76, 76, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 81, 81, 81, 81, 81, 81, 82, 82, 82, 82, 82, 82, 83, 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, 85, 85, 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 91, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 94, 94, 94, 94, 94, 94, 95, 95, 95, 95, 95, 95, 96, 96, 96, 96, 96, 96, 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, 99,100,100,100,100,100,100,101,101,101,101,101,101,102,102,102,102,102,102, 103,103,103,103,103,103,104,104,104,104,104,104,104,105,105,105,105,105,105,106, 106,106,106,106,106,107,107,107,107,107,107,107,108,108,108,108,108,108,109,109, 109,109,109,109,110,110,110,110,110,110,110,111,111,111,111,111,111,112,112,112, 112,112,112,112,113,113,113,113,113,113,114,114,114,114,114,114,115,115,115,115, 115,115,115,116,116,116,116,116,116,117,117,117,117,117,117,117,118,118,118,118, 118,118,118,119,119,119,119,119,119,120,120,120,120,120,120,120,121,121,121,121, 121,121,122,122,122,122,122,122,122,123,123,123,123,123,123,123,124,124,124,124, 124,124,125,125,125,125,125,125,125,126,126,126,126,126,126,126,127,127,127,127, 127,127,128,128,128,128,128,128,128,129,129,129,129,129,129,129,130,130,130,130, 130,130,131,131,131,131,131,131,131,132,132,132,132,132,132,132,133,133,133,133, 133,133,133,134,134,134,134,134,134,134,135,135,135,135,135,135,136,136,136,136, 136,136,136,137,137,137,137,137,137,137,138,138,138,138,138,138,138,139,139,139, 139,139,139,139,140,140,140,140,140,140,140,141,141,141,141,141,141,141,142,142, 142,142,142,142,142,143,143,143,143,143,143,143,144,144,144,144,144,144,144,145, 145,145,145,145,145,145,146,146,146,146,146,146,146,147,147,147,147,147,147,147, 148,148,148,148,148,148,148,149,149,149,149,149,149,149,150,150,150,150,150,150, 150,151,151,151,151,151,151,151,152,152,152,152,152,152,152,153,153,153,153,153, 153,153,154,154,154,154,154,154,154,154,155,155,155,155,155,155,155,156,156,156, 156,156,156,156,157,157,157,157,157,157,157,158,158,158,158,158,158,158,159,159, 159,159,159,159,159,160,160,160,160,160,160,160,160,161,161,161,161,161,161,161, 162,162,162,162,162,162,162,163,163,163,163,163,163,163,163,164,164,164,164,164, 164,164,165,165,165,165,165,165,165,166,166,166,166,166,166,166,167,167,167,167, 167,167,167,167,168,168,168,168,168,168,168,169,169,169,169,169,169,169,169,170, 170,170,170,170,170,170,171,171,171,171,171,171,171,172,172,172,172,172,172,172, 172,173,173,173,173,173,173,173,174,174,174,174,174,174,174,174,175,175,175,175, 175,175,175,176,176,176,176,176,176,176,176,177,177,177,177,177,177,177,178,178, 178,178,178,178,178,178,179,179,179,179,179,179,179,180,180,180,180,180,180,180, 180,181,181,181,181,181,181,181,182,182,182,182,182,182,182,182,183,183,183,183, 183,183,183,184,184,184,184,184,184,184,184,185,185,185,185,185,185,185,186,186, 186,186,186,186,186,186,187,187,187,187,187,187,187,187,188,188,188,188,188,188, 188,189,189,189,189,189,189,189,189,190,190,190,190,190,190,190,190,191,191,191, 191,191,191,191,192,192,192,192,192,192,192,192,193,193,193,193,193,193,193,193, 194,194,194,194,194,194,194,195,195,195,195,195,195,195,195,196,196,196,196,196, 196,196,196,197,197,197,197,197,197,197,197,198,198,198,198,198,198,198,199,199, 199,199,199,199,199,199,200,200,200,200,200,200,200,200,201,201,201,201,201,201, 201,201,202,202,202,202,202,202,202,202,203,203,203,203,203,203,203,204,204,204, 204,204,204,204,204,205,205,205,205,205,205,205,205,206,206,206,206,206,206,206, 206,207,207,207,207,207,207,207,207,208,208,208,208,208,208,208,208,209,209,209, 209,209,209,209,209,210,210,210,210,210,210,210,210,211,211,211,211,211,211,211, 211,212,212,212,212,212,212,212,212,213,213,213,213,213,213,213,213,214,214,214, 214,214,214,214,214,215,215,215,215,215,215,215,215,216,216,216,216,216,216,216, 216,217,217,217,217,217,217,217,217,218,218,218,218,218,218,218,218,219,219,219, 219,219,219,219,219,220,220,220,220,220,220,220,220,221,221,221,221,221,221,221, 221,222,222,222,222,222,222,222,222,223,223,223,223,223,223,223,223,224,224,224, 224,224,224,224,224,225,225,225,225,225,225,225,225,226,226,226,226,226,226,226, 226,227,227,227,227,227,227,227,227,228,228,228,228,228,228,228,228,229,229,229, 229,229,229,229,229,229,230,230,230,230,230,230,230,230,231,231,231,231,231,231, 231,231,232,232,232,232,232,232,232,232,233,233,233,233,233,233,233,233,234,234, 234,234,234,234,234,234,234,235,235,235,235,235,235,235,235,236,236,236,236,236, 236,236,236,237,237,237,237,237,237,237,237,238,238,238,238,238,238,238,238,238, 239,239,239,239,239,239,239,239,240,240,240,240,240,240,240,240,241,241,241,241, 241,241,241,241,242,242,242,242,242,242,242,242,242,243,243,243,243,243,243,243, 243,244,244,244,244,244,244,244,244,245,245,245,245,245,245,245,245,245,246,246, 246,246,246,246,246,246,247,247,247,247,247,247,247,247,248,248,248,248,248,248, 248,248,248,249,249,249,249,249,249,249,249,250,250,250,250,250,250,250,250,250, 251,251,251,251,251,251,251,251,252,252,252,252,252,252,252,252,253,253,253,253, 253,253,253,253,253,254,254,254,254,254,254,254,254,255,255,255,255,255,255,255, 255,255,256,256,256,256,256,256,256,256,257,257,257,257,257,257,257,257,257,258, 258,258,258,258,258,258,258,259,259,259,259,259,259,259,259,259,260,260,260,260, 260,260,260,260,261,261,261,261,261,261,261,261,261,262,262,262,262,262,262,262, 262,263,263,263,263,263,263,263,263,263,264,264,264,264,264,264,264,264,265,265, 265,265,265,265,265,265,265,266,266,266,266,266,266,266,266,267,267,267,267,267, 267,267,267,267,268,268,268,268,268,268,268,268,268,269,269,269,269,269,269,269, 269,270,270,270,270,270,270,270,270,270,271,271,271,271,271,271,271,271,271,272, 272,272,272,272,272,272,272,273,273,273,273,273,273,273,273,273,274,274,274,274, 274,274,274,274,275,275,275,275,275,275,275,275,275,276,276,276,276,276,276,276, 276,276,277,277,277,277,277,277,277,277,277,278,278,278,278,278,278,278,278,279, 279,279,279,279,279,279,279,279,280,280,280,280,280,280,280,280,280,281,281,281, 281,281,281,281,281,282,282,282,282,282,282,282,282,282,283,283,283,283,283,283, 283,283,283,284,284,284,284,284,284,284,284,284,285,285,285,285,285,285,285,285, 286,286,286,286,286,286,286,286,286,287,287,287,287,287,287,287,287,287,288,288, 288,288,288,288,288,288,288,289,289,289,289,289,289,289,289,289,290,290,290,290, 290,290,290,290,291,291,291,291,291,291,291,291,291,292,292,292,292,292,292,292, 292,292,293,293,293,293,293,293,293,293,293,294,294,294,294,294,294,294,294,294, 295,295,295,295,295,295,295,295,295,296,296,296,296,296,296,296,296,296,297,297, 297,297,297,297,297,297,297,298,298,298,298,298,298,298,298,299,299,299,299,299, 299,299,299,299,300,300,300,300,300,300,300,300,300,301,301,301,301,301,301,301, 301,301,302,302,302,302,302,302,302,302,302,303,303,303,303,303,303,303,303,303, 304,304,304,304,304,304,304,304,304,305,305,305,305,305,305,305,305,305,306,306, 306,306,306,306,306,306,306,307,307,307,307,307,307,307,307,307,308,308,308,308, 308,308,308,308,308,309,309,309,309,309,309,309,309,309,310,310,310,310,310,310, 310,310,310,311,311,311,311,311,311,311,311,311,312,312,312,312,312,312,312,312, 312,313,313,313,313,313,313,313,313,313,314,314,314,314,314,314,314,314,314,315, 315,315,315,315,315,315,315,315,316,316,316,316,316,316,316,316,316,317,317,317, 317,317,317,317,317,317,318,318,318,318,318,318,318,318,318,318,319,319,319,319, 319,319,319,319,319,320,320,320,320,320,320,320,320,320,321,321,321,321,321,321, 321,321,321,322,322,322,322,322,322,322,322,322,323,323,323,323,323,323,323,323, 323,324,324,324,324,324,324,324,324,324,325,325,325,325,325,325,325,325,325,325, 326,326,326,326,326,326,326,326,326,327,327,327,327,327,327,327,327,327,328,328, 328,328,328,328,328,328,328,329,329,329,329,329,329,329,329,329,330,330,330,330, 330,330,330,330,330,330,331,331,331,331,331,331,331,331,331,332,332,332,332,332, 332,332,332,332,333,333,333,333,333,333,333,333,333,334,334,334,334,334,334,334, 334,334,335,335,335,335,335,335,335,335,335,335,336,336,336,336,336,336,336,336, 336,337,337,337,337,337,337,337,337,337,338,338,338,338,338,338,338,338,338,338, 339,339,339,339,339,339,339,339,339,340,340,340,340,340,340,340,340,340,341,341, 341,341,341,341,341,341,341,341,342,342,342,342,342,342,342,342,342,343,343,343, 343,343,343,343,343,343,344,344,344,344,344,344,344,344,344,344,345,345,345,345, 345,345,345,345,345,346,346,346,346,346,346,346,346,346,347,347,347,347,347,347, 347,347,347,347,348,348,348,348,348,348,348,348,348,349,349,349,349,349,349,349, 349,349,350,350,350,350,350,350,350,350,350,350,351,351,351,351,351,351,351,351, 351,352,352,352,352,352,352,352,352,352,352,353,353,353,353,353,353,353,353,353, 354,354,354,354,354,354,354,354,354,355,355,355,355,355,355,355,355,355,355,356, 356,356,356,356,356,356,356,356,357,357,357,357,357,357,357,357,357,357,358,358, 358,358,358,358,358,358,358,359,359,359,359,359,359,359,359,359,359,360,360,360, 360,360,360,360,360,360,361,361,361,361,361,361,361,361,361,361,362,362,362,362, 362,362,362,362,362,363,363,363,363,363,363,363,363,363,363,364,364,364,364,364, 364,364,364,364,365,365,365,365,365,365,365,365,365,365,366,366,366,366,366,366, 366,366,366,367,367,367,367,367,367,367,367,367,367,368,368,368,368,368,368,368, 368,368,369,369,369,369,369,369,369,369,369,369,370,370,370,370,370,370,370,370, 370,370,371,371,371,371,371,371,371,371,371,372,372,372,372,372,372,372,372,372, 372,373,373,373,373,373,373,373,373,373,374,374,374,374,374,374,374,374,374,374, 375,375,375,375,375,375,375,375,375,375,376,376,376,376,376,376,376,376,376,377, 377,377,377,377,377,377,377,377,377,378,378,378,378,378,378,378,378,378,379,379, 379,379,379,379,379,379,379,379,380,380,380,380,380,380,380,380,380,380,381,381, 381,381,381,381,381,381,381,382,382,382,382,382,382,382,382,382,382,383,383,383, 383,383,383,383,383,383,383,384,384,384,384,384,384,384,384,384,385,385,385,385, 385,385,385,385,385,385,386,386,386,386,386,386,386,386,386,386,387,387,387,387, 387,387,387,387,387,387,388,388,388,388,388,388,388,388,388,389,389,389,389,389, 389,389,389,389,389,390,390,390,390,390,390,390,390,390,390,391,391,391,391,391, 391,391,391,391,391,392,392,392,392,392,392,392,392,392,393,393,393,393,393,393, 393,393,393,393,394,394,394,394,394,394,394,394,394,394,395,395,395,395,395,395, 395,395,395,395,396,396,396,396,396,396,396,396,396,397,397,397,397,397,397,397, 397,397,397,398,398,398,398,398,398,398,398,398,398,399,399,399,399,399,399,399, 399,399,399,400,400,400,400,400,400,400,400,400,400,401,401,401,401,401,401,401, 401,401,402,402,402,402,402,402,402,402,402,402,403,403,403,403,403,403,403,403, 403,403,404,404,404,404,404,404,404,404,404,404,405,405,405,405,405,405,405,405, 405,405,406,406,406,406,406,406,406,406,406,406,407,407,407,407,407,407,407,407, 407,407,408,408,408,408,408,408,408,408,408,408,409,409,409,409,409,409,409,409, 409,410,410,410,410,410,410,410,410,410,410,411,411,411,411,411,411,411,411,411, 411,412,412,412,412,412,412,412,412,412,412,413,413,413,413,413,413,413,413,413, 413,414,414,414,414,414,414,414,414,414,414,415,415,415,415,415,415,415,415,415, 415,416,416,416,416,416,416,416,416,416,416,417,417,417,417,417,417,417,417,417, 417,418,418,418,418,418,418,418,418,418,418,419,419,419,419,419,419,419,419,419, 419,420,420,420,420,420,420,420,420,420,420,421,421,421,421,421,421,421,421,421, 421,422,422,422,422,422,422,422,422,422,422,423,423,423,423,423,423,423,423,423, 423,424,424,424,424,424,424,424,424,424,424,425,425,425,425,425,425,425,425,425, 425,426,426,426,426,426,426,426,426,426,426,427,427,427,427,427,427,427,427,427, 427,428,428,428,428,428,428,428,428,428,428,429,429,429,429,429,429,429,429,429, 429,430,430,430,430,430,430,430,430,430,430,431,431,431,431,431,431,431,431,431, 431,432,432,432,432,432,432,432,432,432,432,433,433,433,433,433,433,433,433,433, 433,434,434,434,434,434,434,434,434,434,434,435,435,435,435,435,435,435,435,435, 435,435,436,436,436,436,436,436,436,436,436,436,437,437,437,437,437,437,437,437, 437,437,438,438,438,438,438,438,438,438,438,438,439,439,439,439,439,439,439,439, 439,439,440,440,440,440,440,440,440,440,440,440,441,441,441,441,441,441,441,441, 441,441,442,442,442,442,442,442,442,442,442,442,443,443,443,443,443,443,443,443, 443,443,443,444,444,444,444,444,444,444,444,444,444,445,445,445,445,445,445,445, 445,445,445,446,446,446,446,446,446,446,446,446,446,447,447,447,447,447,447,447, 447,447,447,448,448,448,448,448,448,448,448,448,448,448,449,449,449,449,449,449, 449,449,449,449,450,450,450,450,450,450,450,450,450,450,451,451,451,451,451,451, 451,451,451,451,452,452,452,452,452,452,452,452,452,452,453,453,453,453,453,453, 453,453,453,453,453,454,454,454,454,454,454,454,454,454,454,455,455,455,455,455, 455,455,455,455,455,456,456,456,456,456,456,456,456,456,456,457,457,457,457,457, 457,457,457,457,457,457,458,458,458,458,458,458,458,458,458,458,459,459,459,459, 459,459,459,459,459,459,460,460,460,460,460,460,460,460,460,460,460,461,461,461, 461,461,461,461,461,461,461,462,462,462,462,462,462,462,462,462,462,463,463,463, 463,463,463,463,463,463,463,463,464,464,464,464,464,464,464,464,464,464,465,465, 465,465,465,465,465,465,465,465,466,466,466,466,466,466,466,466,466,466,466,467, 467,467,467,467,467,467,467,467,467,468,468,468,468,468,468,468,468,468,468,469, 469,469,469,469,469,469,469,469,469,469,470,470,470,470,470,470,470,470,470,470, 471,471,471,471,471,471,471,471,471,471,472,472,472,472,472,472,472,472,472,472, 472,473,473,473,473,473,473,473,473,473,473,474,474,474,474,474,474,474,474,474, 474,475,475,475,475,475,475,475,475,475,475,475,476,476,476,476,476,476,476,476, 476,476,477,477,477,477,477,477,477,477,477,477,477,478,478,478,478,478,478,478, 478,478,478,479,479,479,479,479,479,479,479,479,479,479,480,480,480,480,480,480, 480,480,480,480,481,481,481,481,481,481,481,481,481,481,482,482,482,482,482,482, 482,482,482,482,482,483,483,483,483,483,483,483,483,483,483,484,484,484,484,484, 484,484,484,484,484,484,485,485,485,485,485,485,485,485,485,485,486,486,486,486, 486,486,486,486,486,486,486,487,487,487,487,487,487,487,487,487,487,488,488,488, 488,488,488,488,488,488,488,488,489,489,489,489,489,489,489,489,489,489,490,490, 490,490,490,490,490,490,490,490,490,491,491,491,491,491,491,491,491,491,491,492, 492,492,492,492,492,492,492,492,492,492,493,493,493,493,493,493,493,493,493,493, 494,494,494,494,494,494,494,494,494,494,494,495,495,495,495,495,495,495,495,495, 495,496,496,496,496,496,496,496,496,496,496,496,497,497,497,497,497,497,497,497, 497,497,497,498,498,498,498,498,498,498,498,498,498,499,499,499,499,499,499,499, 499,499,499,499,500,500,500,500,500,500,500,500,500,500,501,501,501,501,501,501, 501,501,501,501,501,502,502,502,502,502,502,502,502,502,502,503,503,503,503,503, 503,503,503,503,503,503,504,504,504,504,504,504,504,504,504,504,504,505,505,505, 505,505,505,505,505,505,505,506,506,506,506,506,506,506,506,506,506,506,507,507, 507,507,507,507,507,507,507,507,507,508,508,508,508,508,508,508,508,508,508,509, 509,509,509,509,509,509,509,509,509,509,510,510,510,510,510,510,510,510,510,510, 510,511,511,511,511,511,511,511,511,511,511,512,512,512,512,512 }; static const uint8_t order[32] = { 0, 1, 16, 17, 8, 9, 24, 25, 4, 5, 20, 21, 12, 13, 28, 29, 2, 3, 18, 19,10,11, 26, 27, 6, 7, 22, 23, 14, 15, 30, 31 }; static const uint16_t sampr_index[2][3] = { { 22050, 24000, 16000 }, /* MPEG 2 */ { 44100, 48000, 32000 } }; /* MPEG 1 */ static const uint16_t bitr_index[2][15] = { {0, 8,16,24,32,40,48,56, 64, 80, 96,112,128,144,160}, /* MPEG 2 */ {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320} }; /* MPEG 1 */ static const uint8_t num_bands[3][15] = { {0,10,10,10,10,12,14,16, 20, 22, 24, 26, 28, 30, 32}, {0,10,10,10,10,10,12,14, 18, 24, 26, 28, 30, 32, 32}, {0,10,12,14,18,24,26,28, 30, 32, 32, 32, 32, 32, 32} }; static const int16_t cx[9] = { 16135, 10531, 5604, 15396, -2845,-12551, 14189, 8192, 16384 }; static const int16_t ca[8] = {-16859,-15458,-10269, -5961, -3099, -1342, -465, -121 }; static const uint16_t cs[8] = { 28098, 28893, 31117, 32221, 32621, 32740, 32765, 32768 }; static const int16_t enwindow[15*27+24] = { 0, 65, 593, 1766, 22228, 2115, 611, 62, 8, 119, 1419, 10564,-11659,-1635,-154, -9, -8, -119,-1419,-10564, 11659, 1635, 154, 9, 464, 100, 91, 0, 69, 604, 1635, 23148, 2363, 643, 62, 7, 107, 1368, 10449,-12733,-1818,-180,-11, -7, -107,-1368,-10449, 12733, 1818, 180, 11, 420, 200, 164, 0, 72, 608, 1465, 23979, 2600, 671, 63, 7, 94, 1305, 10265,-13818,-2004,-207,-12, -7, -94,-1305,-10265, 13818, 2004, 207, 12, 380, 297, 220, 0, 76, 606, 1256, 24718, 2825, 693, 63, 6, 81, 1232, 10016,-14908,-2192,-236,-14, -6, -81,-1232,-10016, 14908, 2192, 236, 14, 342, 392, 262, 0, 78, 597, 1007, 25359, 3033, 712, 63, 6, 68, 1150, 9706,-15995,-2380,-267,-15, -6, -68,-1150, -9706, 15995, 2380, 267, 15, 307, 483, 289, 0, 80, 580, 719, 25901, 3224, 726, 62, 6, 54, 1060, 9343,-17072,-2565,-299,-17, -6, -54,-1060, -9343, 17072, 2565, 299, 17, 274, 569, 304, -1, 82, 555, 391, 26339, 3395, 735, 61, 5, 40, 963, 8930,-18131,-2747,-332,-19, -5, -40, -963, -8930, 18131, 2747, 332, 19, 242, 650, 307, -1, 83, 523, 26, 26672, 3545, 740, 60, 5, 27, 861, 8474,-19164,-2923,-366,-21, -5, -27, -861, -8474, 19164, 2923, 366, 21, 212, 724, 300, -1, 83, 482, -376, 26900, 3672, 739, 58, 4, 14, 756, 7981,-20163,-3092,-401,-24, -4, -14, -756, -7981, 20163, 3092, 401, 24, 183, 792, 283, -1, 82, 433, -812, 27022, 3776, 735, 56, 4, 1, 648, 7456,-21122,-3250,-435,-26, -4, -1, -648, -7456, 21122, 3250, 435, 26, 155, 851, 258, -1, 81, 376, -1281, 27038, 3855, 726, 54, 3, -11, 539, 6907,-22032,-3397,-470,-28, -3, 11, -539, -6907, 22032, 3397, 470, 28, 128, 903, 226, -1, 78, 312, -1778, 26951, 3910, 713, 52, 3, -22, 430, 6338,-22887,-3530,-503,-31, -3, 22, -430, -6338, 22887, 3530, 503, 31, 102, 946, 188, -2, 75, 239, -2302, 26761, 3941, 696, 49, 3, -33, 322, 5757,-23678,-3648,-537,-34, -3, 33, -322, -5757, 23678, 3648, 537, 34, 76, 980, 145, -2, 70, 160, -2848, 26472, 3948, 676, 47, 3, -42, 217, 5167,-24399,-3749,-568,-36, -3, 42, -217, -5167, 24399, 3749, 568, 36, 50, 1004, 99, -2, 65, 74, -3412, 26087, 3931, 653, 44, 2, -51, 115, 4577,-25045,-3830,-599,-39, -2, 51, -115, -4577, 25045, 3830, 599, 39, 25, 1019, 50, 25610,3891,627,42,-3990,-18,58,-2, 21226,-21226,10604,-10604,1860,-1860,1458,-1458,576,-576,130,-130,60,-60,8,-8 }; static const int16_t win[18][4] = { { -3072, -134, -146, 3352 }, { -2747, -362, -471, 3579 }, { -2387, -529, -831, 3747 }, { -2004, -632,-1214, 3850 }, { -1609, -666,-1609, 3884 }, { -1214, -632,-2004, 3850 }, { -831, -529,-2387, 3747 }, { -471, -362,-2747, 3579 }, { -146, -134,-3072, 3352 }, { 134,-3072,-3352, -146 }, { 362,-2747,-3579, -471 }, { 529,-2387,-3747, -831 }, { 632,-2004,-3850,-1214 }, { 666,-1609,-3884,-1609 }, { 632,-1214,-3850,-2004 }, { 529, -831,-3747,-2387 }, { 362, -471,-3579,-2747 }, { 134, -146,-3352,-3072 } }; static char* mp3_enc_err[] = { /* 0 */ "", /* 1 */ "Cannot open file.", /* 2 */ "'RIFF' missing.", /* 3 */ "'WAVE' missing.", /* 4 */ "'fmt ' missing.", /* 5 */ "Linear PCM required.", /* 6 */ "16 bit per sample required.", /* 7 */ "<=2 channels required.", /* 8 */ "'data' missing.", /* 9 */ "Samplerate not supported." }; static const char* wav_filename; static int mp3file, wavfile, wav_size, frames; static void *enc_buffer; static size_t enc_buffer_size; static int enc_chunk = 0; /* encode chunk counter */ static int enc_size; static config_t cfg; static uint8_t band_scale_f[22]; /* forward declarations */ static int HuffmanCode( short *ix, char *xr_sign, uint32_t begin, uint32_t end, int table); static int HuffmanCod1( short *ix, char *xr_sign, uint32_t begin, uint32_t end, int table); static void putbits(uint32_t val, uint32_t nbit); static int find_best_2( short *ix, uint32_t start, uint32_t end, const uint32_t *table, uint32_t len, int *bits); static int find_best_3( short *ix, uint32_t start, uint32_t end, const uint32_t *table, uint32_t len, int *bits); static int count_bit1 ( short *ix, uint32_t start, uint32_t end, int *bits ); static int count_bigv ( short *ix, uint32_t start, uint32_t end, int table0, int table1, int *bits); bool checkString(int fd, char *string) { char temp[4]; rb->read(fd, temp, 4); /* return 1 on match, 0 on no match */ return !rb->memcmp(temp, string, 4); } int Read16BitsLowHigh(int fd) { char first, second; rb->read(fd, &first, 1); rb->read(fd, &second, 1); return ((int)second << 8) | (first & 0xff); } int Read32BitsLowHigh(int fd) { int first = 0xffff & Read16BitsLowHigh(fd); int second = 0xffff & Read16BitsLowHigh(fd); return (second << 16) + first; } int wave_open(void) { unsigned short wFormatTag; /* rockbox: comment 'set but unused" variable unsigned long dAvgBytesPerSec; unsigned short wBlockAlign; */ unsigned short bits_per_samp; long header_size; if((wavfile = rb->open(wav_filename, O_RDONLY)) < 0) return -1; if(!checkString(wavfile,"RIFF")) return -2; Read32BitsLowHigh(wavfile); /* complete wave chunk size */ if(!checkString(wavfile,"WAVE")) return -3; if(!checkString(wavfile,"fmt ")) return -4; header_size = Read32BitsLowHigh(wavfile); /* chunk size */ wFormatTag = Read16BitsLowHigh(wavfile); cfg.channels = Read16BitsLowHigh(wavfile); cfg.samplerate = Read32BitsLowHigh(wavfile); /*dAvgBytesPerSec*/ Read32BitsLowHigh(wavfile); /*wBlockAlign */ Read16BitsLowHigh(wavfile); bits_per_samp = Read16BitsLowHigh(wavfile); if(wFormatTag != 0x0001) return -5; /* linear PCM required */ if(bits_per_samp != 16) return -6; /* 16 bps required */ if(cfg.channels > 2) return -7; /* <=2 channels required */ if(!checkString(wavfile,"data")) return -8; /* Sample rates != 16/22.05/24/32/44.1/48 kHz are not supported. */ if((cfg.samplerate != 16000) && (cfg.samplerate != 22050) && (cfg.samplerate != 24000) && (cfg.samplerate != 32000) && (cfg.samplerate != 44100) && (cfg.samplerate != 48000)) return -9; header_size = 0x28; wav_size = rb->filesize(wavfile); rb->lseek(wavfile, header_size, SEEK_SET); return 0; } int read_samples(uint16_t *buffer, int num_samples) { uint16_t tmpbuf[MAX_SAMP_PER_FRAME*2]; /* SAMP_PER_FRAME*MAX_CHANNELS */ int byte_per_sample = cfg.channels * 2; /* requires bits_per_sample==16 */ int s, samples = rb->read(wavfile, tmpbuf, byte_per_sample * num_samples) / byte_per_sample; /* Pad last sample with zeros */ memset(tmpbuf + samples*cfg.channels, 0, (num_samples-samples)*cfg.channels); if (cfg.channels==1) { /* interleave the mono samples to stereo as required by encoder */ for(s=0; s<num_samples; s++) buffer[2*s] = tmpbuf[s]; } else { /* interleaving is correct for stereo */ memcpy(buffer, tmpbuf, sizeof(tmpbuf)); } return samples; } static inline uint32_t myswap32(uint32_t val) { const uint8_t* v = (const uint8_t*)&val; return ((uint32_t)v[0]<<24) | ((uint32_t)v[1]<<16) | ((uint32_t)v[2]<<8) | v[3]; } static void encodeSideInfo( side_info_t si[2][2] ) { int gr, ch, header; uint32_t cc=0, sz=0; /* * MPEG header layout: * AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM * A (31-21) = frame sync * B (20-19) = MPEG type * C (18-17) = MPEG layer * D (16) = protection bit * E (15-12) = bitrate index * F (11-10) = samplerate index * G (9) = padding bit * H (8) = private bit * I (7-6) = channel mode * J (5-4) = mode extension (jstereo only) * K (3) = copyright bit * L (2) = original * M (1-0) = emphasis */ header = (0xfff00000) | /* frame sync (AAAAAAAAA AAA) mp3 type (upper): 1 (B) */ (0x01 << 17) | /* mp3 layer: 01 (CC) */ ( 0x1 << 16) | /* mp3 crc: 1 (D) */ ( 0x1 << 2); /* mp3 org: 1 (L) */ header |= cfg.mpg.type << 19; header |= cfg.mpg.bitr_id << 12; header |= cfg.mpg.smpl_id << 10; header |= cfg.mpg.padding << 9; header |= cfg.mpg.mode << 6; /* no emphasis (bits 0-1) */ putbits( header, 32 ); if(cfg.mpg.type == 1) { /* MPEG1 */ if(cfg.channels == 2) { putlong( 0, 20); } else { putlong( 0, 18); } for(gr=0; gr<cfg.granules; gr++) for(ch=0; ch<cfg.channels; ch++) { side_info_t *gi = &si[gr][ch]; putlong((gi->part2_3_length+42),12 ); /* add scale_facs array size */ putlong( gi->address3>>1, 9 ); putlong( gi->global_gain, 8 ); putlong( 9, 4 ); /* set scale_facs compr type */ putlong( gi->table_select[0], 6 ); putlong( gi->table_select[1], 5 ); putlong( gi->table_select[2], 5 ); putlong( gi->region_0_1, 7 ); putlong( 1 , 2 ); /* set scale_facs to 1bit */ putlong( gi->table_select[3], 1 ); } } else { /* MPEG2 */ if(cfg.channels == 2) { putlong( 0, 10); } else { putlong( 0, 9); } for(ch=0; ch<cfg.channels; ch++) { side_info_t *gi = &si[0][ch]; putlong((gi->part2_3_length+42),12 ); /* add scale_facs array size */ putlong( gi->address3>>1, 9 ); putlong( gi->global_gain, 8 ); putlong( 0xCA, 9 ); /* set scale_facs compr type */ putlong( gi->table_select[0], 6 ); putlong( gi->table_select[1], 5 ); putlong( gi->table_select[2], 5 ); putlong( gi->region_0_1 , 7 ); putlong( 1 , 1 ); /* set scale_facs to 1bit */ putlong( gi->table_select[3], 1 ); } } /* flush remaining bits */ putbits(cc, sz); } /* Note the discussion of huffmancodebits() on pages 28 and 29 of the IS, as well as the definitions of the side information on pages 26 and 27. */ static void Huffmancodebits( short *ix, char *xr_sign, side_info_t *gi ) { int region1 = gi->address1; int region2 = gi->address2; int bigvals = gi->address3; int count1 = bigvals + (gi->count1 << 2); int stuffBits = 0; int bits = 0; int i, v; for(i=v=0; i<32; i+=2) v |= band_scale_f[i>>1] << (30-i); putbits(v, 32); // store scale_facs (part1) for(v=0; i<42; i+=2) v |= band_scale_f[i>>1] << (40-i); putbits(v, 10); // store scale_facs (part2) if(region1 > 0) bits += HuffmanCode(ix, xr_sign, 0 , region1, gi->table_select[0]); if(region2 > region1) bits += HuffmanCode(ix, xr_sign, region1, region2, gi->table_select[1]); if(bigvals > region2) bits += HuffmanCode(ix, xr_sign, region2, bigvals, gi->table_select[2]); if(count1 > bigvals) bits += HuffmanCod1(ix, xr_sign, bigvals, count1, gi->table_select[3]); if((stuffBits = gi->part2_3_length - bits) > 0) { int stuffWords = stuffBits >> 5; int remainBits = stuffBits & 31; if( remainBits ) putbits( ~0, remainBits ); while( stuffWords-- ) putbits( ~0, 32 ); /* Huffman code tables leed to padding ones */ } } int HuffmanCod1( short *ix, char *xr_sign, uint32_t begin, uint32_t end, int tbl) { uint32_t cc=0, sz=0; uint32_t i, d, p; int sumbit=0, s=0, l=0, v, w, x, y; #define sgnv xr_sign[i+0] #define sgnw xr_sign[i+1] #define sgnx xr_sign[i+2] #define sgny xr_sign[i+3] for(i=begin; i<end; i+=4) { v = ix[i+0]; w = ix[i+1]; x = ix[i+2]; y = ix[i+3]; p = (v << 3) + (w << 2) + (x << 1) + y; switch(p) { case 0: l=0; s = 0; break; case 1: l=1; s = sgny; break; case 2: l=1; s = sgnx; break; case 3: l=2; s = (sgnx << 1) + sgny; break; case 4: l=1; s = sgnw; break; case 5: l=2; s = (sgnw << 1) + sgny; break; case 6: l=2; s = (sgnw << 1) + sgnx; break; case 7: l=3; s = (sgnw << 2) + (sgnx << 1) + sgny; break; case 8: l=1; s = sgnv; break; case 9: l=2; s = (sgnv << 1) + sgny; break; case 10: l=2; s = (sgnv << 1) + sgnx; break; case 11: l=3; s = (sgnv << 2) + (sgnx << 1) + sgny; break; case 12: l=2; s = (sgnv << 1) + sgnw; break; case 13: l=3; s = (sgnv << 2) + (sgnw << 1) + sgny; break; case 14: l=3; s = (sgnv << 2) + (sgnw << 1) + sgnx; break; case 15: l=4; s = (sgnv << 3) + (sgnw << 2) + (sgnx << 1) + sgny; break; } d = (ht_count[tbl][0][p] << l) + s; l = ht_count[tbl][1][p]; putlong( d, l ); sumbit += l; } /* flush remaining bits */ putbits(cc, sz); return sumbit; } /* Implements the pseudocode of page 98 of the IS */ int HuffmanCode(short *ix, char *xr_sign, uint32_t begin, uint32_t end, int table) { uint32_t cc=0, sz=0, code; uint32_t i, xl=0, yl=0, idx; int x, y, bit, sumbit=0; #define sign_x xr_sign[i+0] #define sign_y xr_sign[i+1] if(table == 0) return 0; if( table > 15 ) { /* ESC-table is used */ uint32_t linbits = ht_big[table-16].linbits; const uint16_t *hffcode = table < 24 ? t16HB : t24HB; const uint8_t *hlen = table < 24 ? t16l : t24l; for(i=begin; i<end; i+=2) { x = ix[ i ]; y = ix[i+1]; if(x > 14) { xl = x - 15; x = 15; } if(y > 14) { yl = y - 15; y = 15; } idx = x * 16 + y; code = hffcode[idx]; bit = hlen [idx]; if(x) { if(x > 14) { code = (code << linbits) | xl; bit += linbits; } code = (code << 1) | sign_x; bit += 1; } if(y) { if(y > 14) { if(bit + linbits + 1 > 32) { putlong( code, bit ); sumbit += bit; code = bit = 0; } code = (code << linbits) | yl; bit += linbits; } code = (code << 1) | sign_y; bit += 1; } putlong( code, bit ); sumbit += bit; } } else { /* No ESC-words */ const struct huffcodetab *h = &ht[table]; for(i=begin; i<end; i+=2) { x = ix[i]; y = ix[i+1]; idx = x * h->len + y; code = h->table[idx]; bit = h->hlen [idx]; if(x) { code = (code << 1) | sign_x; bit += 1; } if(y) { code = (code << 1) | sign_y; bit += 1; } putlong( code, bit ); sumbit += bit; } } /* flush remaining bits */ putbits(cc, sz); return sumbit; } void putbits(uint32_t val, uint32_t nbit) { int new_bitpos = CodedData.bitpos + nbit; int ptrpos = CodedData.bitpos >> 5; val = val & (0xffffffff >> (32 - nbit)); /* data fit in one uint32_t */ if(((new_bitpos - 1) >> 5) == ptrpos) CodedData.bbuf[ptrpos] |= val << ((32 - new_bitpos) & 31); else { CodedData.bbuf[ptrpos ] |= val >> ((new_bitpos - 32) & 31); CodedData.bbuf[ptrpos+1] |= val << ((32 - new_bitpos) & 31); } CodedData.bitpos = new_bitpos; } /***************************************************************************/ /* Choose the Huffman table that will encode ix[begin..end] with */ /* the fewest bits. */ /* Note: This code contains knowledge about the sizes and characteristic */ /* of the Huffman tables as defined in the IS (Table B.7), and will not */ /* work with any arbitrary tables. */ /***************************************************************************/ int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits ) { uint32_t i; int max, table0, table1; for(i=begin,max=0; i<end; i++) if(ix[i] > max) max = ix[i]; if(max < 16) { /* tables without linbits */ /* indx: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ /* len: 0, 2, 3, 3, 0, 4, 4, 6, 6, 6, 8, 8, 8, 16, 0, 16 */ switch(max) { case 0: return 0; case 1: return count_bit1(ix, begin, end, bits); case 2: return 2 + find_best_2(ix, begin, end, tab23, 3, bits); case 3: return 5 + find_best_2(ix, begin, end, tab56, 4, bits); case 4: case 5: return 7 + find_best_3(ix, begin, end, tab789, 6, bits); case 6: case 7: return 10 + find_best_3(ix, begin, end, tabABC, 8, bits); default: return 13 + find_best_2(ix, begin, end, tab1315, 16, bits) * 2; } } else { /* tables with linbits */ max -= 15; for(table0=0; table0<8; table0++) if(ht_big[table0].linmax >= max) break; for(table1=8; table1<16; table1++) if(ht_big[table1].linmax >= max) break; return 16 + count_bigv(ix, begin, end, table0, table1, bits); } } int find_best_2(short *ix, uint32_t start, uint32_t end, const uint32_t *table, uint32_t len, int *bits) { uint32_t i, sum = 0; for(i=start; i<end; i+=2) sum += table[ix[i] * len + ix[i+1]]; if((sum & 0xffff) <= (sum >> 16)) { *bits = (sum & 0xffff); return 1; } else { *bits = sum >> 16; return 0; } } int find_best_3(short *ix, uint32_t start, uint32_t end, const uint32_t *table, uint32_t len, int *bits) { uint32_t i, j, sum = 0; int sum1 = 0; int sum2 = 0; int sum3 = 0; /* avoid overflow in packed additions: 78*13 < 1024 */ for(i=start; i<end; ) { j = i + 2*78 > end ? end : i + 2*78; for(sum=0; i<j; i+=2) sum += table[ix[i] * len + ix[i+1]]; sum1 += (sum >> 20); sum2 += (sum >> 10) & 0x3ff; sum3 += (sum >> 0) & 0x3ff; } i = 0; if(sum1 > sum2) { sum1 = sum2; i = 1; } if(sum1 > sum3) { sum1 = sum3; i = 2; } *bits = sum1; return i; } /*************************************************************************/ /* Function: Count the number of bits necessary to code the subregion. */ /*************************************************************************/ int count_bit1(short *ix, uint32_t start, uint32_t end, int *bits ) { uint32_t i, sum = 0; for(i=start; i<end; i+=2) sum += t1l[4 + ix[i] * 2 + ix[i+1]]; *bits = sum; return 1; /* this is table1 */ } int count_bigv(short *ix, uint32_t start, uint32_t end, int table0, int table1, int *bits ) { uint32_t i, sum0, sum1, sum=0, bigv=0, x, y; /* ESC-table is used */ for(i=start; i<end; i+=2) { x = ix[i]; y = ix[i+1]; if(x > 14) { x = 15; bigv++; } if(y > 14) { y = 15; bigv++; } sum += tab1624[x * 16 + y]; } sum0 = (sum >> 16) + bigv * ht_big[table0].linbits; sum1 = (sum & 0xffff) + bigv * ht_big[table1].linbits; if(sum0 <= sum1) { *bits = sum0; return table0; } else { *bits = sum1; return table1; } } /*************************************************************************/ /* Function: Calculation of rzero, count1, address3 */ /* (Partitions ix into big values, quadruples and zeros). */ /*************************************************************************/ int calc_runlen( short *ix, side_info_t *si ) { int p, i, sum = 0; for(i=SAMPL2; i-=2; ) if(*(uint32_t*)&ix[i-2]) /* !!!! short *ix; !!!!! */ break; si->count1 = 0; for( ; i>3; i-=4) { int v = ix[i-1]; int w = ix[i-2]; int x = ix[i-3]; int y = ix[i-4]; if((v | w | x | y) <= 1) { p = (y<<3) + (x<<2) + (w<<1) + (v); sum += tab01[p]; si->count1++; } else break; } si->address3 = i; if((sum >> 16) < (sum & 0xffff)) { si->table_select[3] = 0; return sum >> 16; } else { si->table_select[3] = 1; return sum & 0xffff; } } /*************************************************************************/ /* Function: Quantization of the vector xr ( -> ix) */ /*************************************************************************/ int quantize_int(int *xr, short *ix, side_info_t *si) { unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 }; s = frac_pow[si->quantStep & 3] >> si->quantStep / 4; /* check for possible 'out of range' values */ if(((si->max_val + 256) >> 8) * s >= (65536 << 8)) return 0; if(((si->max_val + 256) >> 8) * s < (4096 << 8)) { /* all values fit the table size */ for(i=SAMPL2; i--; ) ix[i] = int2idx[(xr[i] * s + 0x8000) >> 16]; } else { /* check each index wether it fits the table */ for(i=SAMPL2; i--; ) { idx = (xr[i] * s + 0x08000) >> 16; if(idx > 4095) ix[i] = int2idx[(idx + 8) >> 4] << 3; else ix[i] = int2idx[idx]; } } return 1; } /*************************************************************************/ /* subdivides the bigvalue region which will use separate Huffman tables */ /*************************************************************************/ void subdivide(side_info_t *si) { int scfb, count0, count1; if( !si->address3 ) { /* no bigvalue region */ si->region_0_1 = 0; si->address1 = 0; si->address2 = 0; } else { /* Calculate scale factor band index */ for(scfb=0; scalefac[scfb] < si->address3; ) scfb++; count0 = subdv_table[scfb].region0_cnt; count1 = subdv_table[scfb].region1_cnt; si->region_0_1 = (count0 << 3) | count1; si->address1 = scalefac[count0 + 1]; si->address2 = scalefac[count0 + 1 + count1 + 1]; } } /*******************************************************************/ /* Count the number of bits necessary to code the bigvalues region */ /*******************************************************************/ int bigv_bitcount(short *ix, side_info_t *gi) { int b1=0, b2=0, b3=0; /* Select huffman code tables for bigvalues regions */ gi->table_select[0] = 0; gi->table_select[1] = 0; gi->table_select[2] = 0; if( gi->address1 > 0 ) /* region0 */ gi->table_select[0] = choose_table(ix, 0 , gi->address1, &b1); if( gi->address2 > gi->address1 ) /* region1 */ gi->table_select[1] = choose_table(ix, gi->address1, gi->address2, &b2); if( gi->address3 > gi->address2 ) /* region2 */ gi->table_select[2] = choose_table(ix, gi->address2, gi->address3, &b3); return b1+b2+b3; } int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) { int bits = 10000; if(quantize_int(xr, ix, si)) { bits = calc_runlen(ix, si); /* rzero,count1,address3 */ subdivide(si); /* bigvalues sfb division */ bits += bigv_bitcount(ix,si); /* bit count */ } return bits; } /************************************************************************/ /* The code selects the best quantStep for a particular set of scalefacs*/ /************************************************************************/ int inner_loop(int *xr, int max_bits, side_info_t *si) { int bits; while((bits=quantize_and_count_bits(xr, enc_data, si)) < max_bits-64) { if(si->quantStep == 0) break; if(si->quantStep <= 2) si->quantStep = 0; else si->quantStep -= 2; } while(bits > max_bits) { si->quantStep++; bits = quantize_and_count_bits(xr, enc_data, si); } return bits; } void iteration_loop(int *xr, side_info_t *si, int gr_cnt) { int remain, tar_bits, max_bits = cfg.mean_bits; /* distribute reserved bits to remaining granules */ tar_bits = max_bits + (cfg.ResvSize / gr_cnt & ~7); if(tar_bits > max_bits + max_bits/2) tar_bits = max_bits + max_bits/2; si->part2_3_length = inner_loop(xr, tar_bits, si); si->global_gain = si->quantStep + 142 - si->additStep; /* unused bits of the reservoir can be used for remaining granules */ cfg.ResvSize += max_bits - si->part2_3_length; /* end: distribute the reserved bits to one or two granules */ if(gr_cnt == 1) { si->part2_3_length += cfg.ResvSize; /* mp3 format allows max 12bits for granule length */ if(si->part2_3_length > 4092) { remain = (si->part2_3_length - 4092 + 31) >> 5; si->part2_3_length -= remain << 5; si[-1].part2_3_length += remain << 5; while(remain--) putbits(~0, 32); } } } /* returns sum_j=0^31 a[j]*cos(PI*j*(k+1/2)/32), 0<=k<32 */ void window_subband1(short *wk, int sb0[SBLIMIT], int sb1[SBLIMIT]) ICODE_ATTR; void window_subband1(short *wk, int sb0[SBLIMIT], int sb1[SBLIMIT]) { int k, i, u, v; short *x1, *x2; short const *wp; #ifdef CPU_COLDFIRE int s0, s1, t0, t1; for(k=0; k<18; k++, wk+=64, sb0+=SBLIMIT, sb1+=SBLIMIT) { wp = enwindow; x1 = wk; x2 = x1 - 124; for(i=-15; i<0; i++) { asm volatile( "move.l (-224*4,%[x2]), %%d4\n" /* d4 = x2[-224] */ "movem.l (%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, (-160*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d0l, %%d4u, %%acc0\n" "mac.w %%d0l, %%d4l, ( -96*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( -32*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( 32*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( 96*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d2l, %%d4u, %%acc0\n" "mac.w %%d2l, %%d4l, ( 160*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, ( 224*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, (-256*4,%[x1]), %%d4, %%acc1\n" "movem.l (16,%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, (-192*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d0l, %%d4u, %%acc0\n" "mac.w %%d0l, %%d4l, (-128*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( -64*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( 0*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( 64*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2l, %%d4u, %%acc0\n" "mac.w %%d2l, %%d4l, ( 128*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, ( 192*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, ( 224*4,%[x1]), %%d4, %%acc1\n" "movclr.l %%acc0, %%d0\n" "move.l %%d0, %[s0]\n" "movclr.l %%acc1, %%d0\n" "move.l %%d0, %[s1]\n" "movem.l (%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, ( 160*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d0l, %%d4u, %%acc0\n" "mac.w %%d0l, %%d4l, ( 96*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( 32*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( -32*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( -96*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2l, %%d4u, %%acc0\n" "mac.w %%d2l, %%d4l, (-160*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, (-224*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, ( 256*4,%[x2]), %%d4, %%acc1\n" "movem.l (32,%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, ( 192*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d0l, %%d4u, %%acc0\n" "mac.w %%d0l, %%d4l, ( 128*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( 64*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( 0*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( -64*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d2l, %%d4u, %%acc0\n" "mac.w %%d2l, %%d4l, (-128*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, (-192*4,%[x2]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, %%acc1\n" "movclr.l %%acc0, %%d0\n" "move.l %%d0, %[t0]\n" "movclr.l %%acc1, %%d0\n" "move.l %%d0, %[t1]\n" : [x1] "+a" (x1), [x2] "+a" (x2), [s0] "+m" (s0), [t0] "+m" (t0), [s1] "+m" (s1), [t1] "+m" (t1) : [wp] "a" (wp) : "d0", "d1", "d2", "d3", "d4"); sb0[30+i*2] = shft4(t0) + shft13(s0) * wp[24]; sb0[31+i*2] = shft13(t0) * wp[25] - shft13(s0) * wp[26]; sb1[30+i*2] = shft4(t1) + shft13(s1) * wp[24]; sb1[31+i*2] = shft13(t1) * wp[25] - shft13(s1) * wp[26]; wp += 27; x1 -= 2; x2 += 2; } asm volatile( "move.l ( -32*4,%[x1]), %%d4\n" /* d4 = x1[-32] */ "movem.l (%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, ( -96*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d0l, %%d4u, %%acc0\n" "mac.w %%d0l, %%d4l, (-160*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, (-224*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( 32*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( 96*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2l, %%d4u, %%acc0\n" "mac.w %%d2l, %%d4l, ( 160*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, ( 224*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, ( -16*4,%[x1]), %%d4, %%acc1\n" "movclr.l %%acc0, %%d0\n" "move.l %%d0, %[s0]\n" "movclr.l %%acc1, %%d0\n" "move.l %%d0, %[s1]\n" "movem.l (16,%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, ( -48*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( 16*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, ( -80*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( 48*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, (-112*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, ( 80*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, (-144*4,%[x1]), %%d4, %%acc1\n" "movem.l (32,%[wp]), %%d0-%%d3\n" /* load 8 values */ "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, ( 112*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d0u, %%d4u, %%acc0\n" "mac.w %%d0u, %%d4l, (-176*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1u, %%d4u, %%acc0\n" "mac.w %%d1u, %%d4l, ( 144*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d1l, %%d4u, %%acc0\n" "mac.w %%d1l, %%d4l, (-208*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, ( 176*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d2u, %%d4u, %%acc0\n" "mac.w %%d2u, %%d4l, (-240*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3u, %%d4u, %%acc0\n" "mac.w %%d3u, %%d4l, ( 208*4,%[x1]), %%d4, %%acc1\n" "mac.w %%d3l, %%d4u, %%acc0\n" "mac.w %%d3l, %%d4l, %%acc1\n" "movclr.l %%acc0, %%d0\n" "move.l %%d0, %[t0]\n" "movclr.l %%acc1, %%d0\n" "move.l %%d0, %[t1]\n" : [x1] "+a" (x1), [s0] "+m" (s0), [t0] "+m" (t0), [s1] "+m" (s1), [t1] "+m" (t1) : [wp] "a" (wp) : "d0", "d1", "d2", "d3", "d4"); u = shft4(s0 - t0); v = shft4(s0 + t0); t0 = sb0[14]; s0 = sb0[15] - t0; sb0[31] = v + t0; /* A0 */ sb0[30] = u + s0; /* A1 */ sb0[15] = u - s0; /* A2 */ sb0[14] = v - t0; /* A3 */ u = shft4(s1 - t1); v = shft4(s1 + t1); t1 = sb1[14]; s1 = sb1[15] - t1; sb1[31] = v + t1; /* A0 */ sb1[30] = u + s1; /* A1 */ sb1[15] = u - s1; /* A2 */ sb1[14] = v - t1; /* A3 */ } #else int ch, s, t, *a; for(ch=0; ch<cfg.channels; ch++) { a = ch ? sb1 : sb0; for(k=0; k<18; k++, wk+=64, a+=SBLIMIT) { wp = enwindow; x1 = wk; x2 = x1 - 124; /* x1[-572] .... x1[448] = 1022 */ /* 18*4*16*32 */ for(i=-15; i<0; i++) { s = (int)x2[-224*2] * wp[ 0]; t = (int)x1[ 224*2] * wp[ 0]; s += (int)x2[-160*2] * wp[ 1]; t += (int)x1[ 160*2] * wp[ 1]; s += (int)x2[- 96*2] * wp[ 2]; t += (int)x1[ 96*2] * wp[ 2]; s += (int)x2[- 32*2] * wp[ 3]; t += (int)x1[ 32*2] * wp[ 3]; s += (int)x2[ 32*2] * wp[ 4]; t += (int)x1[- 32*2] * wp[ 4]; s += (int)x2[ 96*2] * wp[ 5]; t += (int)x1[- 96*2] * wp[ 5]; s += (int)x2[ 160*2] * wp[ 6]; t += (int)x1[-160*2] * wp[ 6]; s += (int)x2[ 224*2] * wp[ 7]; t += (int)x1[-224*2] * wp[ 7]; s += (int)x1[-256*2] * wp[ 8]; t += (int)x2[ 256*2] * wp[16]; s += (int)x1[-192*2] * wp[ 9]; t += (int)x2[ 192*2] * wp[17]; s += (int)x1[-128*2] * wp[10]; t += (int)x2[ 128*2] * wp[18]; s += (int)x1[- 64*2] * wp[11]; t += (int)x2[ 64*2] * wp[19]; s += (int)x1[ 0*2] * wp[12]; t += (int)x2[ 0*2] * wp[20]; s += (int)x1[ 64*2] * wp[13]; t += (int)x2[- 64*2] * wp[21]; s += (int)x1[ 128*2] * wp[14]; t += (int)x2[-128*2] * wp[22]; s += (int)x1[ 192*2] * wp[15]; t += (int)x2[-192*2] * wp[23]; a[30+i*2] = shft4(t) + shft13(s) * wp[24]; a[31+i*2] = shft13(t) * wp[25] - shft13(s) * wp[26]; wp += 27; x1 -= 2; x2 += 2; } t = (int)x1[- 16*2] * wp[ 8]; s = (int)x1[ -32*2] * wp[0]; t += ((int)x1[- 48*2]-x1[ 16*2]) * wp[10]; s += (int)x1[ -96*2] * wp[1]; t += ((int)x1[- 80*2]+x1[ 48*2]) * wp[12]; s += (int)x1[-160*2] * wp[2]; t += ((int)x1[-112*2]-x1[ 80*2]) * wp[14]; s += (int)x1[-224*2] * wp[3]; t += ((int)x1[-144*2]+x1[112*2]) * wp[16]; s += (int)x1[ 32*2] * wp[4]; t += ((int)x1[-176*2]-x1[144*2]) * wp[18]; s += (int)x1[ 96*2] * wp[5]; t += ((int)x1[-208*2]+x1[176*2]) * wp[20]; s += (int)x1[ 160*2] * wp[6]; t += ((int)x1[-240*2]-x1[208*2]) * wp[22]; s += (int)x1[ 224*2] * wp[7]; u = shft4(s - t); v = shft4(s + t); t = a[14]; s = a[15] - t; a[31] = v + t; /* A0 */ a[30] = u + s; /* A1 */ a[15] = u - s; /* A2 */ a[14] = v - t; /* A3 */ } wk -= 18 * 64 - 1; /* rewind wk (to next channel start) */ } #endif } void window_subband2(short *x1, int a[SBLIMIT]) ICODE_ATTR; void window_subband2(short *x1, int a[SBLIMIT]) { int xr; short const *wp = enwindow; short *x2 = x1 - 124; wp += 27 * 15; x1 -= 2 * 15; x2 += 2 * 15; xr = a[28] - a[0]; a[0] += a[28]; a[28] = shft9(xr) * wp[-2*27+25]; xr = a[29] - a[1]; a[1] += a[29]; a[29] = shft9(xr) * wp[-2*27+25]; xr = a[26] - a[2]; a[2] += a[26]; a[26] = shft9(xr) * wp[-4*27+25]; xr = a[27] - a[3]; a[3] += a[27]; a[27] = shft9(xr) * wp[-4*27+25]; xr = a[24] - a[4]; a[4] += a[24]; a[24] = shft9(xr) * wp[-6*27+25]; xr = a[25] - a[5]; a[5] += a[25]; a[25] = shft9(xr) * wp[-6*27+25]; xr = a[22] - a[6]; a[6] += a[22]; a[22] = shft9(xr) * SQRT ; xr = a[23] - a[7]; a[7] += a[23]; a[23] = shft9(xr) * SQRT - a[7]; a[ 7] -= a[ 6]; a[22] -= a[ 7]; a[23] -= a[22]; xr = a[ 6]; a[ 6] = a[31] - xr; a[31] = a[31] + xr; xr = a[ 7]; a[ 7] = a[30] - xr; a[30] = a[30] + xr; xr = a[22]; a[22] = a[15] - xr; a[15] = a[15] + xr; xr = a[23]; a[23] = a[14] - xr; a[14] = a[14] + xr; xr = a[20] - a[ 8]; a[ 8] += a[20]; a[20] = shft9(xr) * wp[-10*27+25]; xr = a[21] - a[ 9]; a[ 9] += a[21]; a[21] = shft9(xr) * wp[-10*27+25]; xr = a[18] - a[10]; a[10] += a[18]; a[18] = shft9(xr) * wp[-12*27+25]; xr = a[19] - a[11]; a[11] += a[19]; a[19] = shft9(xr) * wp[-12*27+25]; xr = a[16] - a[12]; a[12] += a[16]; a[16] = shft9(xr) * wp[-14*27+25]; xr = a[17] - a[13]; a[13] += a[17]; a[17] = shft9(xr) * wp[-14*27+25]; xr =-a[20] + a[24]; a[20] += a[24]; a[24] = shft9(xr) * wp[-12*27+25]; xr =-a[21] + a[25]; a[21] += a[25]; a[25] = shft9(xr) * wp[-12*27+25]; xr = a[ 4] - a[ 8]; a[ 4] += a[ 8]; a[ 8] = shft9(xr) * wp[-12*27+25]; xr = a[ 5] - a[ 9]; a[ 5] += a[ 9]; a[ 9] = shft9(xr) * wp[-12*27+25]; xr = a[ 0] - a[12]; a[ 0] += a[12]; a[12] = shft9(xr) * wp[ -4*27+25]; xr = a[ 1] - a[13]; a[ 1] += a[13]; a[13] = shft9(xr) * wp[ -4*27+25]; xr = a[16] - a[28]; a[16] += a[28]; a[28] = shft9(xr) * wp[ -4*27+25]; xr =-a[17] + a[29]; a[17] += a[29]; a[29] = shft9(xr) * wp[ -4*27+25]; xr = SQRT * shft9(a[ 2] - a[10]); a[ 2] += a[10]; a[10] = xr; xr = SQRT * shft9(a[ 3] - a[11]); a[ 3] += a[11]; a[11] = xr; xr = SQRT * shft9(a[26] - a[18]); a[18] += a[26]; a[26] = xr - a[18]; xr = SQRT * shft9(a[27] - a[19]); a[19] += a[27]; a[27] = xr - a[19]; xr = a[ 2]; a[19] -= a[ 3]; a[ 3] -= xr; a[ 2] = a[31] - xr; a[31] += xr; xr = a[ 3]; a[11] -= a[19]; a[18] -= xr; a[ 3] = a[30] - xr; a[30] += xr; xr = a[18]; a[27] -= a[11]; a[19] -= xr; a[18] = a[15] - xr; a[15] += xr; xr = a[19]; a[10] -= xr; a[19] = a[14] - xr; a[14] += xr; xr = a[10]; a[11] -= xr; a[10] = a[23] - xr; a[23] += xr; xr = a[11]; a[26] -= xr; a[11] = a[22] - xr; a[22] += xr; xr = a[26]; a[27] -= xr; a[26] = a[ 7] - xr; a[ 7] += xr; xr = a[27]; a[27] = a[6] - xr; a[6] += xr; xr = SQRT * shft9(a[ 0] - a[ 4]); a[ 0] += a[ 4]; a[ 4] = xr; xr = SQRT * shft9(a[ 1] - a[ 5]); a[ 1] += a[ 5]; a[ 5] = xr; xr = SQRT * shft9(a[16] - a[20]); a[16] += a[20]; a[20] = xr; xr = SQRT * shft9(a[17] - a[21]); a[17] += a[21]; a[21] = xr; xr =-SQRT * shft9(a[ 8] - a[12]); a[ 8] += a[12]; a[12] = xr - a[ 8]; xr =-SQRT * shft9(a[ 9] - a[13]); a[ 9] += a[13]; a[13] = xr - a[ 9]; xr =-SQRT * shft9(a[25] - a[29]); a[25] += a[29]; a[29] = xr - a[25]; xr =-SQRT * shft9(a[24] + a[28]); a[24] -= a[28]; a[28] = xr - a[24]; xr = a[24] - a[16]; a[24] = xr; xr = a[20] - xr; a[20] = xr; xr = a[28] - xr; a[28] = xr; xr = a[25] - a[17]; a[25] = xr; xr = a[21] - xr; a[21] = xr; xr = a[29] - xr; a[29] = xr; xr = a[17] - a[1]; a[17] = xr; xr = a[ 9] - xr; a[ 9] = xr; xr = a[25] - xr; a[25] = xr; xr = a[ 5] - xr; a[ 5] = xr; xr = a[21] - xr; a[21] = xr; xr = a[13] - xr; a[13] = xr; xr = a[29] - xr; a[29] = xr; xr = a[ 1] - a[0]; a[ 1] = xr; xr = a[16] - xr; a[16] = xr; xr = a[17] - xr; a[17] = xr; xr = a[ 8] - xr; a[ 8] = xr; xr = a[ 9] - xr; a[ 9] = xr; xr = a[24] - xr; a[24] = xr; xr = a[25] - xr; a[25] = xr; xr = a[ 4] - xr; a[ 4] = xr; xr = a[ 5] - xr; a[ 5] = xr; xr = a[20] - xr; a[20] = xr; xr = a[21] - xr; a[21] = xr; xr = a[12] - xr; a[12] = xr; xr = a[13] - xr; a[13] = xr; xr = a[28] - xr; a[28] = xr; xr = a[29] - xr; a[29] = xr; xr = a[ 0]; a[ 0] += a[31]; a[31] -= xr; xr = a[ 1]; a[ 1] += a[30]; a[30] -= xr; xr = a[16]; a[16] += a[15]; a[15] -= xr; xr = a[17]; a[17] += a[14]; a[14] -= xr; xr = a[ 8]; a[ 8] += a[23]; a[23] -= xr; xr = a[ 9]; a[ 9] += a[22]; a[22] -= xr; xr = a[24]; a[24] += a[ 7]; a[ 7] -= xr; xr = a[25]; a[25] += a[ 6]; a[ 6] -= xr; xr = a[ 4]; a[ 4] += a[27]; a[27] -= xr; xr = a[ 5]; a[ 5] += a[26]; a[26] -= xr; xr = a[20]; a[20] += a[11]; a[11] -= xr; xr = a[21]; a[21] += a[10]; a[10] -= xr; xr = a[12]; a[12] += a[19]; a[19] -= xr; xr = a[13]; a[13] += a[18]; a[18] -= xr; xr = a[28]; a[28] += a[ 3]; a[ 3] -= xr; xr = a[29]; a[29] += a[ 2]; a[ 2] -= xr; } void mdct_long(int *out, int *in) ICODE_ATTR; void mdct_long(int *out, int *in) { int ct,st; int tc1, tc2, tc3, tc4, ts5, ts6, ts7, ts8; int ts1, ts2, ts3, ts4, tc5, tc6, tc7, tc8; /* 1,2, 5,6, 9,10, 13,14, 17 */ tc1 = in[17] - in[ 9]; tc3 = in[15] - in[11]; tc4 = in[14] - in[12]; ts5 = in[ 0] + in[ 8]; ts6 = in[ 1] + in[ 7]; ts7 = in[ 2] + in[ 6]; ts8 = in[ 3] + in[ 5]; out[17] = (ts5 + ts7 - ts8) * cx[8] - (ts6 - in[4]) * cx[8]; st = (ts5 + ts7 - ts8) * cx[7] + (ts6 - in[4]) * cx[8]; ct = (tc1 - tc3 - tc4) * cx[6]; out[5] = ct + st; out[6] = ct - st; tc2 = (in[16] - in[10]) * cx[6]; ts6 = ts6 * cx[7] + in[4] * cx[8]; ct = tc1 * cx[0] + tc2 + tc3 * cx[1] + tc4 * cx[2]; st = -ts5 * cx[4] + ts6 - ts7 * cx[5] + ts8 * cx[3]; out[1] = ct + st; out[2] = ct - st; ct = tc1 * cx[1] - tc2 - tc3 * cx[2] + tc4 * cx[0]; st = -ts5 * cx[5] + ts6 - ts7 * cx[3] + ts8 * cx[4]; out[ 9] = ct + st; out[10] = ct - st; ct = tc1 * cx[2] - tc2 + tc3 * cx[0] - tc4 * cx[1]; st = ts5 * cx[3] - ts6 + ts7 * cx[4] - ts8 * cx[5]; out[13] = ct + st; out[14] = ct - st; ts1 = in[ 8] - in[ 0]; ts3 = in[ 6] - in[ 2]; ts4 = in[ 5] - in[ 3]; tc5 = in[17] + in[ 9]; tc6 = in[16] + in[10]; tc7 = in[15] + in[11]; tc8 = in[14] + in[12]; out[0] = (tc5 + tc7 + tc8) * cx[8] + (tc6 + in[13]) * cx[8]; ct = (tc5 + tc7 + tc8) * cx[7] - (tc6 + in[13]) * cx[8]; st = (ts1 - ts3 + ts4) * cx[6]; out[11] = ct + st; out[12] = ct - st; ts2 = (in[7] - in[1]) * cx[6]; tc6 = in[13] * cx[8] - tc6 * cx[7]; ct = tc5 * cx[3] - tc6 + tc7 * cx[4] + tc8 * cx[5]; st = ts1 * cx[2] + ts2 + ts3 * cx[0] + ts4 * cx[1]; out[3] = ct + st; out[4] = ct - st; ct =-tc5 * cx[5] + tc6 - tc7 * cx[3] - tc8 * cx[4]; st = ts1 * cx[1] + ts2 - ts3 * cx[2] - ts4 * cx[0]; out[7] = ct + st; out[8] = ct - st; ct =-tc5 * cx[4] + tc6 - tc7 * cx[5] - tc8 * cx[3]; st = ts1 * cx[0] - ts2 + ts3 * cx[1] - ts4 * cx[2]; out[15] = ct + st; out[16] = ct - st; } static int find_bitrate_index(int type, uint16_t bitrate) { int i; for(i=0;i<14;i++) if(bitrate == bitr_index[type][i]) break; return i; } static int find_samplerate_index(uint16_t freq, int *mp3_type) { int mpg, rate; /* set default values: MPEG1 at 44100/s */ *mp3_type = 1; for(mpg=0; mpg<2; mpg++) for(rate=0; rate<3; rate++) if(freq == sampr_index[mpg][rate]) { *mp3_type = mpg; return rate; } return 0; } void init_mp3_encoder_engine(bool stereo, int bitrate, uint16_t sample_rate) { uint32_t avg_byte_per_frame; #ifdef ROCKBOX_LITTLE_ENDIAN cfg.byte_order = order_littleEndian; #else cfg.byte_order = order_bigEndian; #endif cfg.samplerate = sample_rate; cfg.channels = stereo ? 2 : 1; cfg.mpg.mode = stereo ? 0 : 3; /* 0=stereo, 3=mono */ cfg.mpg.bitrate = stereo ? bitrate : bitrate > 160 ? 160 : bitrate; cfg.mpg.smpl_id = find_samplerate_index(cfg.samplerate, &cfg.mpg.type); cfg.mpg.bitr_id = find_bitrate_index(cfg.mpg.type, cfg.mpg.bitrate); cfg.mpg.num_bands = num_bands[stereo ? cfg.mpg.type : 2][cfg.mpg.bitr_id]; if(0 == cfg.mpg.type) { /* use MPEG2 format */ cfg.smpl_per_frm = MAX_SAMP_PER_FRAME/2; cfg.granules = 1; } else { /* use MPEG1 format */ cfg.smpl_per_frm = MAX_SAMP_PER_FRAME; cfg.granules = 2; } scalefac = sfBand[cfg.mpg.smpl_id + 3*cfg.mpg.type]; ht[ 0].table = NULL; ht[ 0].hlen = NULL; /* Apparently not used */ ht[ 1].table = t1HB; ht[ 1].hlen = t1l; ht[ 2].table = t2HB; ht[ 2].hlen = t2l; ht[ 3].table = t3HB; ht[ 3].hlen = t3l; ht[ 4].table = NULL; ht[ 4].hlen = NULL; /* Apparently not used */ ht[ 5].table = t5HB; ht[ 5].hlen = t5l; ht[ 6].table = t6HB; ht[ 6].hlen = t6l; ht[ 7].table = t7HB; ht[ 7].hlen = t7l; ht[ 8].table = t8HB; ht[ 8].hlen = t8l; ht[ 9].table = t9HB; ht[ 9].hlen = t9l; ht[10].table = t10HB; ht[10].hlen = t10l; ht[11].table = t11HB; ht[11].hlen = t11l; ht[12].table = t12HB; ht[12].hlen = t12l; ht[13].table = t13HB; ht[13].hlen = t13l; ht[14].table = NULL; ht[14].hlen = NULL; /* Apparently not used */ ht[15].table = t15HB; ht[15].hlen = t15l; /* Figure average number of 'bytes' per frame */ avg_byte_per_frame = SAMPL2 * 16000 * cfg.mpg.bitrate / (2 - cfg.mpg.type); avg_byte_per_frame = avg_byte_per_frame / cfg.samplerate; cfg.byte_per_frame = avg_byte_per_frame / 64; cfg.frac_per_frame = avg_byte_per_frame & 63; cfg.slot_lag = 0; cfg.sideinfo_len = 32 + (cfg.mpg.type ? (cfg.channels == 1 ? 136 : 256) : (cfg.channels == 1 ? 72 : 136)); } void set_scale_facs(int *mdct_freq) { unsigned int i, is, ie, k, s; int max_freq_val, avrg_freq_val; /* calc average of first 256 frequency values */ for(avrg_freq_val=i=0; i<256; i++) avrg_freq_val += mdct_freq[i]; avrg_freq_val >>= 8; /* if max of current band is smaller than average, increase precision */ /* last band keeps untouched (not scaled) */ for(is=k=0; is<scalefac[21]; k++) { max_freq_val = 0; for(i=is, ie=scalefac[k+1]; i<ie; i++) if(max_freq_val < mdct_freq[i]) max_freq_val = mdct_freq[i]; for(s=0; s<3; s++) if((max_freq_val<<s) > avrg_freq_val) break; band_scale_f[k] = (unsigned char)s; for(i=is; s && i<ie; i++) mdct_freq[i] <<= s; is = ie; } } void compress(void) { int i, gr, gr_cnt; uint32_t max; while(1) { if((frames & 7) == 0) { rb->lcd_clear_display(); rb->lcd_putsxyf(4, 20, "Frame %d / %d", frames, wav_size/cfg.smpl_per_frm/cfg.channels/2); rb->lcd_update(); } /* encode one mp3 frame in this loop */ memset(CodedData.bbuf, 0, sizeof(CodedData.bbuf)); if((cfg.slot_lag += cfg.frac_per_frame) >= 64) { /* Padding for this frame */ cfg.slot_lag -= 64; cfg.mpg.padding = 1; } else cfg.mpg.padding = 0; cfg.mean_bits = (8 * cfg.byte_per_frame + 8 * cfg.mpg.padding - cfg.sideinfo_len) / cfg.granules / cfg.channels - 42; // reserved for scale_facs /* shift out old samples */ memcpy(mfbuf, mfbuf + 2*cfg.granules*576, 4*512); /* read new samples to iram for further processing */ if(read_samples((mfbuf + 2*512), cfg.smpl_per_frm) == 0) break; /* swap bytes if neccessary */ if(cfg.byte_order == order_bigEndian) for(i=0; i<cfg.smpl_per_frm; i++) { uint32_t t = ((uint32_t*)mfbuf)[512 + i]; t = ((t >> 8) & 0xff00ff) | ((t << 8) & 0xff00ff00); ((uint32_t*)mfbuf)[512 + i] = t; } cfg.ResvSize = 0; gr_cnt = cfg.granules * cfg.channels; CodedData.bitpos = cfg.sideinfo_len; /* leave space for mp3 header */ for(gr=0; gr<cfg.granules; gr++) { short *wk = mfbuf + 2*286 + gr*1152; int ch; /* 16bit packed wav data can be windowed efficiently on coldfire */ window_subband1(wk, sb_data[0][1-gr][0], sb_data[1][1-gr][0]); for(ch=0; ch<cfg.channels; ch++) {