diff options
author | John Koleszar <jkoleszar@google.com> | 2010-05-18 11:58:33 -0400 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2010-05-18 11:58:33 -0400 |
commit | 0ea50ce9cb4b65eee6afa1d041fe8beb5abda667 (patch) | |
tree | 1f3b9019f28bc56fd3156f96e5a9653a983ee61b /examples/decode_with_drops.txt | |
download | libvpx-0ea50ce9cb4b65eee6afa1d041fe8beb5abda667.tar libvpx-0ea50ce9cb4b65eee6afa1d041fe8beb5abda667.tar.gz libvpx-0ea50ce9cb4b65eee6afa1d041fe8beb5abda667.tar.bz2 libvpx-0ea50ce9cb4b65eee6afa1d041fe8beb5abda667.zip |
Initial WebM release
Diffstat (limited to 'examples/decode_with_drops.txt')
-rw-r--r-- | examples/decode_with_drops.txt | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/examples/decode_with_drops.txt b/examples/decode_with_drops.txt new file mode 100644 index 000000000..fb77a7e06 --- /dev/null +++ b/examples/decode_with_drops.txt @@ -0,0 +1,73 @@ +@TEMPLATE decoder_tmpl.c +Decode With Drops Example +========================= +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION +This is an example utility which drops a series of frames, as specified +on the command line. This is useful for observing the error recovery +features of the codec. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INTRODUCTION + +Usage +----- +This example adds a single argument to the `simple_decoder` example, +which specifies the range or pattern of frames to drop. The parameter is +parsed as follows: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE +if(argc!=4) + die("Usage: %s <infile> <outfile> <N-M|N/M>\n", argv[0]); +{ + char *nptr; + n = strtol(argv[3], &nptr, 0); + m = strtol(nptr+1, NULL, 0); + is_range = *nptr == '-'; + if(!n || !m || (*nptr != '-' && *nptr != '/')) + die("Couldn't parse pattern %s\n", argv[3]); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ USAGE + + +Dropping A Range Of Frames +-------------------------- +To drop a range of frames, specify the starting frame and the ending +frame to drop, separated by a dash. The following command will drop +frames 5 through 10 (base 1). + + $ ./decode_with_drops in.ivf out.i420 5-10 + + +Dropping A Pattern Of Frames +---------------------------- +To drop a pattern of frames, specify the number of frames to drop and +the number of frames after which to repeat the pattern, separated by +a forward-slash. The following command will drop 3 of 7 frames. +Specifically, it will decode 4 frames, then drop 3 frames, and then +repeat. + + $ ./decode_with_drops in.ivf out.i420 3/7 + + +Extra Variables +--------------- +This example maintains the pattern passed on the command line in the +`n`, `m`, and `is_range` variables: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS +int n, m, is_range; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXTRA_VARS + + +Making The Drop Decision +------------------------ +The example decides whether to drop the frame based on the current +frame number, immediately before decoding the frame. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE +if((is_range && frame_cnt >= n && frame_cnt <= m) + ||(!is_range && m - (frame_cnt-1)%m <= n)) { + putc('X', stdout); + continue; +} +putc('.', stdout); +fflush(stdout); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PRE_DECODE |