Home | History | Annotate | Download | only in encoder
      1 /*
      2  *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 
     12 #if 0
     13 
     14 #include <map>
     15 #include <string>
     16 #include <fstream>
     17 extern "C"
     18 {
     19     #include "vp8/common/onyx.h"
     20 }
     21 
     22 
     23 using namespace std;
     24 
     25 typedef map<string,int> Parms;
     26 
     27 #define ALLPARMS(O,DOTHIS) \
     28     DOTHIS(O,  interquantizer             )\
     29     DOTHIS(O,  auto_gold                   )\
     30     DOTHIS(O,  auto_adjust_gold_quantizer    )\
     31     DOTHIS(O,  goldquantizer              )\
     32     DOTHIS(O,  goldfreq                   )\
     33     DOTHIS(O,  auto_key                    )\
     34     DOTHIS(O,  auto_adjust_key_quantizer     )\
     35     DOTHIS(O,  keyquantizer               )\
     36     DOTHIS(O,  keyfreq                    )\
     37     DOTHIS(O,  pass                       )\
     38     DOTHIS(O,  fixed_q                     )\
     39     DOTHIS(O,  target_bandwidth            )\
     40     DOTHIS(O,  auto_worst_q                 )\
     41     DOTHIS(O,  worst_quality               )\
     42     DOTHIS(O,  best_allowed_q               )\
     43     DOTHIS(O,  end_usage                   )\
     44     DOTHIS(O,  starting_buffer_level        )\
     45     DOTHIS(O,  optimal_buffer_level         )\
     46     DOTHIS(O,  maximum_buffer_size          )\
     47     DOTHIS(O,  under_shoot_pct              )\
     48     DOTHIS(O,  allow_df                    )\
     49     DOTHIS(O,  drop_frames_water_mark        )\
     50     DOTHIS(O,  max_allowed_datarate         )\
     51     DOTHIS(O,  two_pass_vbrbias             )\
     52     DOTHIS(O,  two_pass_vbrmin_section       )\
     53     DOTHIS(O,  two_pass_vbrmax_section       )\
     54     DOTHIS(O,  filter_type                 )\
     55     DOTHIS(O,  compressor_speed            )\
     56     DOTHIS(O,  mbpitch_feature             )\
     57     DOTHIS(O,  allow_spatial_resampling     )\
     58     DOTHIS(O,  resample_down_water_mark      )\
     59     DOTHIS(O,  resample_up_water_mark        )\
     60     DOTHIS(O,  noise_sensitivity           )\
     61     DOTHIS(O,  horiz_scale                 )\
     62     DOTHIS(O,  vert_scale                  )
     63 
     64 
     65 #define GET(O,V) O->V = x[#V];
     66 #define PUT(O,V) x[#V] = O->V;
     67 
     68 
     69 extern "C" void get_parms(VP8_CONFIG *ocf,char *filename)
     70 {
     71 
     72     Parms x;
     73     int value;
     74     string variable;
     75     string equal;
     76 
     77     ifstream config_file(filename);
     78 
     79     ALLPARMS(ocf, PUT);
     80 
     81     // store all the parms in a map (really simple parsing)
     82     while(!config_file.eof() && config_file.is_open())
     83     {
     84         config_file >> variable;
     85         config_file >> equal;
     86 
     87         if(equal != "=")
     88             continue;
     89 
     90         config_file >> value;
     91 
     92         x[variable] = value;
     93     }
     94 
     95     ALLPARMS(ocf, GET);
     96 
     97 }
     98 
     99 #define PRINT(O,V) debug_file<<#V <<" = " << O->V <<"\n";
    100 extern "C" void print_parms(VP8_CONFIG *ocf,char *filename)
    101 {
    102     ofstream debug_file(filename,ios_base::app);
    103     ALLPARMS(ocf, PRINT);
    104     debug_file << "=============================================="<<"\n";
    105 }
    106 
    107 #endif
    108