summaryrefslogtreecommitdiff
path: root/vp8/encoder/parms.cpp
blob: 66fdafb1afd2f7b14dd1b57f8af12804f45558b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 *  Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license and patent
 *  grant that can be found in the LICENSE file in the root of the source
 *  tree. All contributing project authors may be found in the AUTHORS
 *  file in the root of the source tree.
 */


#if 0

#include <map>
#include <string>
#include <fstream>
extern "C"
{
    #include "onyx.h"
}


using namespace std;

typedef map<string,int> Parms;

#define ALLPARMS(O,DOTHIS) \
    DOTHIS(O,  interquantizer             )\
    DOTHIS(O,  auto_gold                   )\
    DOTHIS(O,  auto_adjust_gold_quantizer    )\
    DOTHIS(O,  goldquantizer              )\
    DOTHIS(O,  goldfreq                   )\
    DOTHIS(O,  auto_key                    )\
    DOTHIS(O,  auto_adjust_key_quantizer     )\
    DOTHIS(O,  keyquantizer               )\
    DOTHIS(O,  keyfreq                    )\
    DOTHIS(O,  pass                       )\
    DOTHIS(O,  fixed_q                     )\
    DOTHIS(O,  target_bandwidth            )\
    DOTHIS(O,  auto_worst_q                 )\
    DOTHIS(O,  worst_quality               )\
    DOTHIS(O,  best_allowed_q               )\
    DOTHIS(O,  end_usage                   )\
    DOTHIS(O,  starting_buffer_level        )\
    DOTHIS(O,  optimal_buffer_level         )\
    DOTHIS(O,  maximum_buffer_size          )\
    DOTHIS(O,  under_shoot_pct              )\
    DOTHIS(O,  allow_df                    )\
    DOTHIS(O,  drop_frames_water_mark        )\
    DOTHIS(O,  max_allowed_datarate         )\
    DOTHIS(O,  two_pass_vbrbias             )\
    DOTHIS(O,  two_pass_vbrmin_section       )\
    DOTHIS(O,  two_pass_vbrmax_section       )\
    DOTHIS(O,  filter_type                 )\
    DOTHIS(O,  compressor_speed            )\
    DOTHIS(O,  mbpitch_feature             )\
    DOTHIS(O,  allow_spatial_resampling     )\
    DOTHIS(O,  resample_down_water_mark      )\
    DOTHIS(O,  resample_up_water_mark        )\
    DOTHIS(O,  noise_sensitivity           )\
    DOTHIS(O,  horiz_scale                 )\
    DOTHIS(O,  vert_scale                  )


#define GET(O,V) O->V = x[#V];
#define PUT(O,V) x[#V] = O->V;


extern "C" void get_parms(VP8_CONFIG *ocf,char *filename)
{

    Parms x;
    int value;
    string variable;
    string equal;

    ifstream config_file(filename);

    ALLPARMS(ocf, PUT);

    // store all the parms in a map (really simple parsing)
    while(!config_file.eof() && config_file.is_open())
    {
        config_file >> variable;
        config_file >> equal;

        if(equal != "=")
            continue;

        config_file >> value;

        x[variable] = value;
    }

    ALLPARMS(ocf, GET);

}

#define PRINT(O,V) debug_file<<#V <<" = " << O->V <<"\n";
extern "C" void print_parms(VP8_CONFIG *ocf,char *filename)
{
    ofstream debug_file(filename,ios_base::app);
    ALLPARMS(ocf, PRINT);
    debug_file << "=============================================="<<"\n";
}

#endif