Mercurial > libavcodec.hg
comparison mace.c @ 1064:b32afefe7d33 libavcodec
* UINTX -> uintx_t INTX -> intx_t
| author | kabi |
|---|---|
| date | Tue, 11 Feb 2003 16:35:48 +0000 |
| parents | 6faecb29b3b5 |
| children | 1e39f273ecd6 |
comparison
equal
deleted
inserted
replaced
| 1063:fdeac9642346 | 1064:b32afefe7d33 |
|---|---|
| 22 * Adapted to ffmpeg by Francois Revol <revol@free.fr> | 22 * Adapted to ffmpeg by Francois Revol <revol@free.fr> |
| 23 * (removed 68k REG stuff, changed types, added some statics and consts, | 23 * (removed 68k REG stuff, changed types, added some statics and consts, |
| 24 * libavcodec api, context stuff, interlaced stereo out). | 24 * libavcodec api, context stuff, interlaced stereo out). |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 static const UINT16 MACEtab1[] = { 0xfff3, 0x0008, 0x004c, 0x00de, 0x00de, 0x004c, 0x0008, 0xfff3 }; | 27 static const uint16_t MACEtab1[] = { 0xfff3, 0x0008, 0x004c, 0x00de, 0x00de, 0x004c, 0x0008, 0xfff3 }; |
| 28 | 28 |
| 29 static const UINT16 MACEtab3[] = { 0xffee, 0x008c, 0x008c, 0xffee }; | 29 static const uint16_t MACEtab3[] = { 0xffee, 0x008c, 0x008c, 0xffee }; |
| 30 | 30 |
| 31 static const UINT16 MACEtab2[][8] = { | 31 static const uint16_t MACEtab2[][8] = { |
| 32 { 0x0025, 0x0074, 0x00CE, 0x014A, 0xFEB5, 0xFF31, 0xFF8B, 0xFFDA }, | 32 { 0x0025, 0x0074, 0x00CE, 0x014A, 0xFEB5, 0xFF31, 0xFF8B, 0xFFDA }, |
| 33 { 0x0027, 0x0079, 0x00D8, 0x015A, 0xFEA5, 0xFF27, 0xFF86, 0xFFD8 }, | 33 { 0x0027, 0x0079, 0x00D8, 0x015A, 0xFEA5, 0xFF27, 0xFF86, 0xFFD8 }, |
| 34 { 0x0029, 0x007F, 0x00E1, 0x0169, 0xFE96, 0xFF1E, 0xFF80, 0xFFD6 }, | 34 { 0x0029, 0x007F, 0x00E1, 0x0169, 0xFE96, 0xFF1E, 0xFF80, 0xFFD6 }, |
| 35 { 0x002A, 0x0084, 0x00EB, 0x0179, 0xFE86, 0xFF14, 0xFF7B, 0xFFD5 }, | 35 { 0x002A, 0x0084, 0x00EB, 0x0179, 0xFE86, 0xFF14, 0xFF7B, 0xFFD5 }, |
| 36 { 0x002C, 0x0089, 0x00F5, 0x0188, 0xFE77, 0xFF0A, 0xFF76, 0xFFD3 }, | 36 { 0x002C, 0x0089, 0x00F5, 0x0188, 0xFE77, 0xFF0A, 0xFF76, 0xFFD3 }, |
| 157 { 0x2281, 0x6A6A, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x9595, 0xDD7E }, | 157 { 0x2281, 0x6A6A, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x9595, 0xDD7E }, |
| 158 { 0x240C, 0x6F29, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x90D6, 0xDBF3 }, | 158 { 0x240C, 0x6F29, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x90D6, 0xDBF3 }, |
| 159 { 0x25A7, 0x741F, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x8BE0, 0xDA58 }, | 159 { 0x25A7, 0x741F, 0x7FFF, 0x7FFF, 0x8000, 0x8000, 0x8BE0, 0xDA58 }, |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 static const UINT16 MACEtab4[][8] = { | 162 static const uint16_t MACEtab4[][8] = { |
| 163 { 0x0040, 0x00D8, 0xFF27, 0xFFBF, 0, 0, 0, 0 }, { 0x0043, 0x00E2, 0xFF1D, 0xFFBC, 0, 0, 0, 0 }, | 163 { 0x0040, 0x00D8, 0xFF27, 0xFFBF, 0, 0, 0, 0 }, { 0x0043, 0x00E2, 0xFF1D, 0xFFBC, 0, 0, 0, 0 }, |
| 164 { 0x0046, 0x00EC, 0xFF13, 0xFFB9, 0, 0, 0, 0 }, { 0x004A, 0x00F6, 0xFF09, 0xFFB5, 0, 0, 0, 0 }, | 164 { 0x0046, 0x00EC, 0xFF13, 0xFFB9, 0, 0, 0, 0 }, { 0x004A, 0x00F6, 0xFF09, 0xFFB5, 0, 0, 0, 0 }, |
| 165 { 0x004D, 0x0101, 0xFEFE, 0xFFB2, 0, 0, 0, 0 }, { 0x0050, 0x010C, 0xFEF3, 0xFFAF, 0, 0, 0, 0 }, | 165 { 0x004D, 0x0101, 0xFEFE, 0xFFB2, 0, 0, 0, 0 }, { 0x0050, 0x010C, 0xFEF3, 0xFFAF, 0, 0, 0, 0 }, |
| 166 { 0x0054, 0x0118, 0xFEE7, 0xFFAB, 0, 0, 0, 0 }, { 0x0058, 0x0126, 0xFED9, 0xFFA7, 0, 0, 0, 0 }, | 166 { 0x0054, 0x0118, 0xFEE7, 0xFFAB, 0, 0, 0, 0 }, { 0x0058, 0x0126, 0xFED9, 0xFFA7, 0, 0, 0, 0 }, |
| 167 { 0x005C, 0x0133, 0xFECC, 0xFFA3, 0, 0, 0, 0 }, { 0x0060, 0x0141, 0xFEBE, 0xFF9F, 0, 0, 0, 0 }, | 167 { 0x005C, 0x0133, 0xFECC, 0xFFA3, 0, 0, 0, 0 }, { 0x0060, 0x0141, 0xFEBE, 0xFF9F, 0, 0, 0, 0 }, |
| 232 short *outPtr; | 232 short *outPtr; |
| 233 } MACEContext; | 233 } MACEContext; |
| 234 | 234 |
| 235 /* /// "chomp3()" */ | 235 /* /// "chomp3()" */ |
| 236 static void chomp3(MACEContext *ctx, | 236 static void chomp3(MACEContext *ctx, |
| 237 UINT8 val, | 237 uint8_t val, |
| 238 const UINT16 tab1[], | 238 const uint16_t tab1[], |
| 239 const UINT16 tab2[][8]) | 239 const uint16_t tab2[][8]) |
| 240 { | 240 { |
| 241 short current; | 241 short current; |
| 242 | 242 |
| 243 current=(short)tab2[(ctx->index & 0x7f0) >> 4][val]; | 243 current=(short)tab2[(ctx->index & 0x7f0) >> 4][val]; |
| 244 if (current+ctx->lev > 32767) current=32767; | 244 if (current+ctx->lev > 32767) current=32767; |
| 251 } | 251 } |
| 252 /* \\\ */ | 252 /* \\\ */ |
| 253 | 253 |
| 254 /* /// "Exp1to3()" */ | 254 /* /// "Exp1to3()" */ |
| 255 static void Exp1to3(MACEContext *ctx, | 255 static void Exp1to3(MACEContext *ctx, |
| 256 UINT8 *inBuffer, | 256 uint8_t *inBuffer, |
| 257 void *outBuffer, | 257 void *outBuffer, |
| 258 UINT32 cnt, | 258 uint32_t cnt, |
| 259 UINT32 numChannels, | 259 uint32_t numChannels, |
| 260 UINT32 whichChannel) | 260 uint32_t whichChannel) |
| 261 { | 261 { |
| 262 UINT8 pkt; | 262 uint8_t pkt; |
| 263 | 263 |
| 264 /* | 264 /* |
| 265 if (inState) { | 265 if (inState) { |
| 266 ctx->index=inState[0]; | 266 ctx->index=inState[0]; |
| 267 ctx->lev=inState[1]; | 267 ctx->lev=inState[1]; |
| 296 } | 296 } |
| 297 /* \\\ */ | 297 /* \\\ */ |
| 298 | 298 |
| 299 /* /// "chomp6()" */ | 299 /* /// "chomp6()" */ |
| 300 static void chomp6(MACEContext *ctx, | 300 static void chomp6(MACEContext *ctx, |
| 301 UINT8 val, | 301 uint8_t val, |
| 302 const UINT16 tab1[], | 302 const uint16_t tab1[], |
| 303 const UINT16 tab2[][8]) | 303 const uint16_t tab2[][8]) |
| 304 { | 304 { |
| 305 short current; | 305 short current; |
| 306 | 306 |
| 307 current=(short)tab2[(ctx->index & 0x7f0) >> 4][val]; | 307 current=(short)tab2[(ctx->index & 0x7f0) >> 4][val]; |
| 308 | 308 |
| 333 } | 333 } |
| 334 /* \\\ */ | 334 /* \\\ */ |
| 335 | 335 |
| 336 /* /// "Exp1to6()" */ | 336 /* /// "Exp1to6()" */ |
| 337 static void Exp1to6(MACEContext *ctx, | 337 static void Exp1to6(MACEContext *ctx, |
| 338 UINT8 *inBuffer, | 338 uint8_t *inBuffer, |
| 339 void *outBuffer, | 339 void *outBuffer, |
| 340 UINT32 cnt, | 340 uint32_t cnt, |
| 341 UINT32 numChannels, | 341 uint32_t numChannels, |
| 342 UINT32 whichChannel) | 342 uint32_t whichChannel) |
| 343 { | 343 { |
| 344 UINT8 pkt; | 344 uint8_t pkt; |
| 345 | 345 |
| 346 /* | 346 /* |
| 347 if (inState) { | 347 if (inState) { |
| 348 ctx->previous=inState[0]; | 348 ctx->previous=inState[0]; |
| 349 ctx->prev2=inState[1]; | 349 ctx->prev2=inState[1]; |
| 387 return 0; | 387 return 0; |
| 388 } | 388 } |
| 389 | 389 |
| 390 static int mace_decode_frame(AVCodecContext *avctx, | 390 static int mace_decode_frame(AVCodecContext *avctx, |
| 391 void *data, int *data_size, | 391 void *data, int *data_size, |
| 392 UINT8 *buf, int buf_size) | 392 uint8_t *buf, int buf_size) |
| 393 { | 393 { |
| 394 short *samples; | 394 short *samples; |
| 395 MACEContext *c = avctx->priv_data; | 395 MACEContext *c = avctx->priv_data; |
| 396 | 396 |
| 397 samples = (short *)data; | 397 samples = (short *)data; |
