changeset 6:b55451463161

amrdiff: recognize DHF transform
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 03 Apr 2024 20:15:37 +0000
parents 6ac30bef2b4b
children e81a8c274fa6
files amrdiff/amrdiff.c
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/amrdiff/amrdiff.c	Wed Apr 03 20:10:38 2024 +0000
+++ b/amrdiff/amrdiff.c	Wed Apr 03 20:15:37 2024 +0000
@@ -12,6 +12,26 @@
 #include "etsi.h"
 #include "amr_defs.h"
 
+const uint8_t amr122_dhf_bits[244] = {
+0,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,1,1,0,1,1,0,1,1,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,0,
+1,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,
+1,0,0,0,0,0,1,1,0,1,1,1,1,0,0,1,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,
+0,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,0,1,0,0,1,1,1,1,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,0,
+1,0,1,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,
+0,0,0,0
+};
+
+const uint8_t efr_dhf_bits[244] = {
+0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,1,1,1,1,1,0,1,0,
+1,0,1,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,1,0,0,0,0,1,1,0,0,0,
+0,1,1,0,0,0,0,0,0,1,1,1,1,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,1,1,0,0,0,0,0,0,
+1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,0,
+1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,
+};
+
 main(argc, argv)
 	char **argv;
 {
@@ -99,7 +119,12 @@
 				amr_sp, efr_sp);
 			continue;
 		}
-		if (bcmp(amr_bits+1, efr_bits, 244))
+		if (!bcmp(amr_bits+1, efr_bits, 244))
+			continue;
+		if (!bcmp(amr_bits+1, amr122_dhf_bits, 244) &&
+		    !bcmp(efr_bits, efr_dhf_bits, 244))
+			printf("frame #%u: DHF transform\n", frame_no);
+		else
 			printf("frame #%u: bits differ\n", frame_no);
 	}
 	exit(0);