2 Copyright (C) 2014 StarBrilliant <m13253@hotmail.com>
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 static gint blocksize
= 8;
22 static gint quantizer
= 4;
24 static gint qmax
= -1;
25 static gchar
*framesize
;
26 static guint framewidth
= 0, frameheight
= 0;
27 static gboolean grayonly
= FALSE
;
28 static gboolean verbose
= FALSE
;
29 static GOptionEntry entries
[] = {
30 {"blocksize", 'b', 0, G_OPTION_ARG_INT
, &blocksize
, "DCT block size [default: 8]", "BLOCKSIZE"},
31 {"quantizer", 'q', 0, G_OPTION_ARG_INT
, &quantizer
, "Quantizer step length, lower for more data capacity (0..7) [default: 4]", "QUANTIZER"},
32 {"qmin", 0, 0, G_OPTION_ARG_INT
, &qmin
, "Minimum DCT index used, lower for more data capacity (0..BLOCKSIZE*BLOCKSIZE-1) [default: 1]", "QMIN"},
33 {"qmax", 0, 0, G_OPTION_ARG_INT
, &qmax
, "Maximum DCT index used, higher for more data capacity (1..BLOCKSIZE*BLOCKSIZE) [default: BLOCKSIZE*BLOCKSIZE/2]", "QMAX"},
34 {"size", 's', 0, G_OPTION_ARG_STRING
, &framesize
, "Frame size, must be multipliers of block size", "WIDTHxHEIGHT"},
35 {"gray", 'g', 0, G_OPTION_ARG_NONE
, &grayonly
, "Use luminance only", NULL
},
36 {"verbose", 'v', 0, G_OPTION_ARG_NONE
, &verbose
, "Print debug information", NULL
},
40 int lvdo_dispatch(FILE *fi
, FILE *fo
, unsigned int blocksize
, unsigned int quantizer
, unsigned int qmin
, unsigned int qmax
, unsigned int width
, unsigned int height
, int grayonly
, int verbose
);
42 int main(int argc
, char *argv
[]) {
44 GOptionContext
*context
;
46 context
= g_option_context_new("- video steganography experiments");
47 g_option_context_add_main_entries(context
, entries
, NULL
);
48 if(!g_option_context_parse(context
, &argc
, &argv
, &error
)) {
49 g_printerr("Argument error: %s\n", error
->message
);
50 g_option_context_free(context
);
53 g_option_context_free(context
);
55 g_printerr("Argument error: blocksize should be a positive integer\n");
58 if(quantizer
< 0 || quantizer
> 7) {
59 g_printerr("Argument error: quantizer should be between 0 and 7\n");
63 qmax
= blocksize
*blocksize
/2;
64 if(qmin
< 0 || qmin
> blocksize
*blocksize
) {
65 g_printerr("Argument error: qmin should be between 0 and %d\n", blocksize
*blocksize
);
68 if(qmax
< 0 || qmax
> blocksize
*blocksize
) {
69 g_printerr("Argument error: qmax should be between 0 and %d\n", blocksize
*blocksize
);
73 g_printerr("Argument error: qmax should be greater than qmin\n");
76 if(framesize
&& framesize
[0]) {
77 sscanf(framesize
, "%ux%u", &framewidth
, &frameheight
);
79 if(framewidth
== 0 || frameheight
== 0) {
80 g_printerr("Argument error: frame size should be specified with \"-s WIDTHxHEIGHT\"\n");
84 if(framewidth
% blocksize
!= 0 || frameheight
% blocksize
!= 0) {
85 g_printerr("Argument error: frame size can not be divided by %d\n", blocksize
);
89 if(framewidth
% (blocksize
*2) != 0 || frameheight
% (blocksize
*2) != 0) {
90 g_printerr("Argument error: frame size can not be divided by %d\n", blocksize
*2);
93 return lvdo_dispatch(stdin
, stdout
, blocksize
, quantizer
, qmin
, qmax
, framewidth
, frameheight
, grayonly
, verbose
);