stats.c
上传用户:aoeyumen
上传日期:2007-01-06
资源大小:3329k
文件大小:3k
源码类别:

DVD

开发平台:

Unix_Linux

  1. /* 
  2.  *  stats.c
  3.  *
  4.  * Copyright (C) Aaron Holtzman - May 1999
  5.  *
  6.  *  This file is part of ac3dec, a free Dolby AC-3 stream decoder.
  7.  *
  8.  *  ac3dec is free software; you can redistribute it and/or modify
  9.  *  it under the terms of the GNU General Public License as published by
  10.  *  the Free Software Foundation; either version 2, or (at your option)
  11.  *  any later version.
  12.  *   
  13.  *  ac3dec is distributed in the hope that it will be useful,
  14.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.  *  GNU General Public License for more details.
  17.  *   
  18.  *  You should have received a copy of the GNU General Public License
  19.  *  along with GNU Make; see the file COPYING.  If not, write to
  20.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  21.  *
  22.  */
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include "ac3.h"
  26. #include "decode.h"
  27. #include "stats.h"
  28. #include "debug.h"
  29. /* Misc LUTs that will go elsewhere soon */
  30. static char *service_ids[] = {"CM","ME","VI","HI","D","C","E","VO"};
  31. struct mixlev_s
  32. {
  33. float clev;
  34. char *desc;
  35. };
  36. struct mixlev_s cmixlev_tbl[4] =  {{0.707, "(-3.0 dB)"}, {0.595, "(-4.5 dB)"},
  37.                                  {0.500, "(-6.0 dB)"}, {1.0,  "Invalid"}};
  38. struct mixlev_s smixlev_tbl[4] =  {{0.707, "(-3.0 dB)"}, {0.500, "(-6.0 dB)"},
  39.                                    {0.0,   "off    "}, {1.0,   "Invalid"}};
  40. void stats_printf_syncinfo(syncinfo_t *syncinfo)
  41. {
  42. dprintf("(syncinfo) ");
  43. switch (syncinfo->fscod)
  44. {
  45. case 2:
  46. dprintf("32 KHz   ");
  47. break;
  48. case 1:
  49. dprintf("44.1 KHz ");
  50. break;
  51. case 0:
  52. dprintf("48 KHz   ");
  53. break;
  54. default:
  55. dprintf("Invalid sampling rate ");
  56. break;
  57. }
  58. dprintf("%4d kbps %4d words per framen",syncinfo->bit_rate, 
  59. syncinfo->frame_size);
  60. }
  61. void stats_printf_bsi(bsi_t *bsi)
  62. {
  63. dprintf("(bsi) ");
  64. dprintf("%s",service_ids[bsi->bsmod]);
  65. dprintf(" %d.%d Mode ",bsi->nfchans,bsi->lfeon);
  66. if ((bsi->acmod & 0x1) && (bsi->acmod != 0x1))
  67. dprintf(" Centre Mix Level %s ",cmixlev_tbl[bsi->cmixlev].desc);
  68. if (bsi->acmod & 0x4)
  69. dprintf(" Sur Mix Level %s ",smixlev_tbl[bsi->cmixlev].desc);
  70. dprintf("n");
  71. }
  72. char *exp_strat_tbl[4] = {"R   ","D15 ","D25 ","D45 "};
  73. void stats_printf_audblk(audblk_t *audblk)
  74. {
  75. dprintf("(audblk) ");
  76. dprintf("%s ",audblk->cplinu ? "cpl on " : "cpl off");
  77. dprintf("%s ",audblk->baie? "bai " : "    ");
  78. dprintf("%s ",audblk->snroffste? "snroffst " : "         ");
  79. dprintf("%s ",audblk->deltbaie? "deltba " : "       ");
  80. dprintf("(%s %s %s %s %s) ",exp_strat_tbl[audblk->chexpstr[0]],
  81. exp_strat_tbl[audblk->chexpstr[1]],exp_strat_tbl[audblk->chexpstr[2]],
  82. exp_strat_tbl[audblk->chexpstr[3]],exp_strat_tbl[audblk->chexpstr[4]]);
  83. dprintf("n");
  84. }