[MPlayer-cvslog] r29739 - trunk/libmpdemux/demux_mkv.c

reimar subversion at mplayerhq.hu
Wed Sep 30 09:52:37 CEST 2009


Author: reimar
Date: Wed Sep 30 09:52:37 2009
New Revision: 29739

Log:
Simplify aac_get_sample_rate_index

Modified:
   trunk/libmpdemux/demux_mkv.c

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	Wed Sep 30 09:48:01 2009	(r29738)
+++ trunk/libmpdemux/demux_mkv.c	Wed Sep 30 09:52:37 2009	(r29739)
@@ -257,30 +257,10 @@ add_cluster_position (mkv_demuxer_t *mkv
 static int
 aac_get_sample_rate_index (uint32_t sample_rate)
 {
-  if (92017 <= sample_rate)
-    return 0;
-  else if (75132 <= sample_rate)
-    return 1;
-  else if (55426 <= sample_rate)
-    return 2;
-  else if (46009 <= sample_rate)
-    return 3;
-  else if (37566 <= sample_rate)
-    return 4;
-  else if (27713 <= sample_rate)
-    return 5;
-  else if (23004 <= sample_rate)
-    return 6;
-  else if (18783 <= sample_rate)
-    return 7;
-  else if (13856 <= sample_rate)
-    return 8;
-  else if (11502 <= sample_rate)
-    return 9;
-  else if (9391 <= sample_rate)
-    return 10;
-  else
-    return 11;
+  static const int srates[] = {92017, 75132, 55426, 46009, 37566, 27713, 23004, 18783, 13856, 11502, 9391, 0};
+  int i = 0;
+  while (sample_rate < srates[i]) i++;
+  return i;
 }
 
 /** \brief Free cached demux packets


More information about the MPlayer-cvslog mailing list