From 3d21062751b4c50d79e5e0f8e869f9edbb1c923a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 7 Oct 2016 12:27:22 +0000 Subject: [PATCH] Use a less aggressive mask, effectively AP68, in place of AP70 and AP72. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7156 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/qra/qra64/qra64.c | 37 +++++++++++++++++++++++++++++-------- lib/qra/qra64/qra64.h | 4 ++-- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lib/qra/qra64/qra64.c b/lib/qra/qra64/qra64.c index 73e2a230e..efa87dc4b 100644 --- a/lib/qra/qra64/qra64.c +++ b/lib/qra/qra64/qra64.c @@ -62,6 +62,7 @@ static int qra64_do_decode(int *x, const float *pix, const int *ap_mask, #define MASK_CALL1 0xFFFFFFF #define MASK_CALL2 0xFFFFFFF #define MASK_GRIDFULL 0xFFFF +#define MASK_GRIDFULL12 0x3FFC // less aggressive mask (to be used with full AP decoding) #define MASK_GRIDBIT 0x8000 // b[15] is 1 for free text, 0 otherwise // ---------------------------------------------------------------------------- @@ -101,9 +102,9 @@ qra64codec *qra64_init(int flags) encodemsg_jt65(pcodec->apmask_call2, 0, MASK_CALL2, MASK_GRIDBIT); encodemsg_jt65(pcodec->apmask_call2_ooo, 0, MASK_CALL2, MASK_GRIDFULL); encodemsg_jt65(pcodec->apmask_call1_call2, MASK_CALL1,MASK_CALL2, MASK_GRIDBIT); - encodemsg_jt65(pcodec->apmask_call1_call2_grid,MASK_CALL1,MASK_CALL2, MASK_GRIDFULL); + encodemsg_jt65(pcodec->apmask_call1_call2_grid,MASK_CALL1,MASK_CALL2, MASK_GRIDFULL12); encodemsg_jt65(pcodec->apmask_cq_call2, MASK_CQQRZ, MASK_CALL2, MASK_GRIDBIT); - encodemsg_jt65(pcodec->apmask_cq_call2_ooo, MASK_CQQRZ, MASK_CALL2, MASK_GRIDFULL); + encodemsg_jt65(pcodec->apmask_cq_call2_ooo, MASK_CQQRZ, MASK_CALL2, MASK_GRIDFULL12); return pcodec; } @@ -313,20 +314,40 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *rxen) if (rc>=0) { rc = 9; goto decode_end; }; // decoded [cq/qrz hiscall ?] rc = qra64_do_decode(xdec, ix, pcodec->apmask_cq_call2_ooo, - pcodec->apmsg_cq_call2_grid); - if (rc>=0) { rc = 11; goto decode_end; }; // decoded [cq/qrz hiscall grid] + pcodec->apmsg_cq_call2_grid); + if (rc>=0) { + // Full AP mask need special handling + // To minimize false decodes we check the decoded message + // with what passed in the ap_set call + if (memcmp(pcodec->apmsg_cq_call2_grid,xdec, QRA64_K*sizeof(int))!=0) + return -1; + rc = 11; goto decode_end; + }; // decoded [cq/qrz hiscall grid] rc = qra64_do_decode(xdec, ix, pcodec->apmask_cq_call2_ooo, pcodec->apmsg_cq_call2); - if (rc>=0) { rc = 10; goto decode_end; }; // decoded [cq/qrz hiscall ] + if (rc>=0) { + // Full AP mask need special handling + // To minimize false decodes we check the decoded message + // with what passed in the ap_set call + if (memcmp(pcodec->apmsg_cq_call2,xdec, QRA64_K*sizeof(int))!=0) + return -1; + rc = 10; goto decode_end; }; // decoded [cq/qrz hiscall ] } - // attempt to decode [mycall hiscall grid] if (pcodec->apmsg_set[APTYPE_FULL]) { rc = qra64_do_decode(xdec, ix, pcodec->apmask_call1_call2_grid, - pcodec->apmsg_call1_call2_grid); - if (rc>=0) { rc = 8; goto decode_end; }; // decoded [mycall hiscall grid] + pcodec->apmsg_call1_call2_grid); + if (rc>=0) { + // Full AP mask need special handling + // All the three msg fields were given. + // To minimize false decodes we check the decoded message + // with what passed in the ap_set call + if (memcmp(pcodec->apmsg_call1_call2_grid,xdec, QRA64_K*sizeof(int))!=0) + return -1; + rc = 8; goto decode_end; + }; // decoded [mycall hiscall grid] } // all decoding attempts failed diff --git a/lib/qra/qra64/qra64.h b/lib/qra/qra64/qra64.h index 53d7de98f..e4b431872 100644 --- a/lib/qra/qra64/qra64.h +++ b/lib/qra/qra64/qra64.h @@ -133,9 +133,9 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *r); // rc=5 [CALL CALL ?] AP57 // rc=6 [? CALL ?] AP29 // rc=7 [? CALL ] AP45 -// rc=8 [CALL CALL GRID] AP72 +// rc=8 [CALL CALL GRID] AP72 (actually a AP68 mask to reduce false decodes) // rc=9 [CQ CALL ?] AP55 -// rc=10 [CQ CALL ] AP70 +// rc=10 [CQ CALL ] AP70 (actaully a AP68 mask to reduce false decodes) // return codes in the range 1-10 indicate the amount and the type of a-priori // information was required to decode the received message.