From b25021100436ada451cdd22e5a4d9a644d2bc3d7 Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Mon, 7 Aug 2017 23:48:00 +0200 Subject: AAC: skip PAD if only zero F-PAD This optimizations saves four bytes if no X-PAD is present. --- src/odr-audioenc.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp index 94e47cc..ff743bb 100644 --- a/src/odr-audioenc.cpp +++ b/src/odr-audioenc.cpp @@ -982,7 +982,18 @@ int main(int argc, char *argv[]) throw runtime_error(ss.str()); } - status |= STATUS_PAD_INSERTED; + /* + * AAC: skip PAD if only zero F-PAD (saves four bytes) + * See §5.4.3 in ETSI TS 102 563 + */ + if ( + selected_encoder == encoder_selection_t::fdk_dabplus && + calculated_padlen == 2 && + pad_buf[padlen - 2] == 0x00 && + pad_buf[padlen - 1] == 0x00 + ) { + calculated_padlen = 0; + } } else { // Some other error occurred during read. @@ -990,6 +1001,8 @@ int main(int argc, char *argv[]) break; } } + if (calculated_padlen) + status |= STATUS_PAD_INSERTED; // -------------- Read Data -- cgit v1.2.3