strm.flags = AEC_DATA_PREPROCESS;
opterr = 0;
- while ((c = getopt (argc, argv, "3b:cdj:mn:r:st")) != -1)
+ while ((c = getopt (argc, argv, "3b:cdj:mn:pr:st")) != -1)
switch (c) {
case '3':
strm.flags |= AEC_DATA_3BYTE;
case 'n':
strm.bits_per_sample = atoi(optarg);
break;
+ case 'p':
+ strm.flags |= AEC_PAD_RSI;
+ break;
case 'r':
strm.rsi = atoi(optarg);
break;
strm.flags |= AEC_DATA_SIGNED;
break;
case 't':
- strm.flags |= AEC_DATA_RESTRICT;
+ strm.flags |= AEC_RESTRICTED;
break;
case '?':
if (optopt == 'b')
fprintf(stderr, "Usage: %s [OPTION] SOURCE\n", argv[0]);
fprintf(stderr, "\nOPTIONS\n");
fprintf(stderr, "-3\n 24 bit samples are sored in 3 bytes\n");
- fprintf(stderr, "-b\n internal buffer size\n");
+ fprintf(stderr, "-b size\n internal buffer sizein bytes\n");
fprintf(stderr, "-c\n write output on standard output\n");
- fprintf(stderr, "-d\n decode SOURCE. If -d is not specified encode.\n");
- fprintf(stderr, "-j\n block size in samples\n");
+ fprintf(stderr, "-d\n decode SOURCE. If -d is not used: encode.\n");
+ fprintf(stderr, "-j samples\n block size in samples\n");
fprintf(stderr, "-m\n samples are MSB first. Default is LSB\n");
- fprintf(stderr, "-n\n bits per sample\n");
- fprintf(stderr, "-r\n reference sample interval in blocks\n");
+ fprintf(stderr, "-n bits\n bits per sample\n");
+ fprintf(stderr, "-p\n pad RSI to byte boundary\n");
+ fprintf(stderr, "-r blocks\n reference sample interval in blocks\n");
fprintf(stderr, "-s\n samples are signed. Default is unsigned\n");
fprintf(stderr, "-t\n use restricted set of code options\n\n");
exit(-1);
state->flush_output(strm);
state->flush_start = state->rsi_buffer;
state->rsip = state->rsi_buffer;
+ if (strm->flags & AEC_PAD_RSI)
+ state->bitp -= state->bitp % 8;
}
}
else
state->flush_output = flush_lsb_16;
} else {
- if (strm->flags & AEC_DATA_RESTRICT) {
+ if (strm->flags & AEC_RESTRICTED) {
if (strm->bits_per_sample <= 4) {
if (strm->bits_per_sample <= 2)
state->id_len = 1;
* of the host. Default is LSB.
*/
#define AEC_DATA_PREPROCESS 8 /* Set if preprocessor should be used */
-#define AEC_DATA_RESTRICT 16 /* Use restricted set of code options */
+
+#define AEC_RESTRICTED 16 /* Use restricted set of code options */
+#define AEC_PAD_RSI 32 /* Pad RSI to byte boundary. Only for
+ * decoding CCSDS sample data. */
/* Return codes of library functions */
#define AEC_OK 0