| 885 | } |
| 886 | |
| 887 | static gboolean term_matches(struct srd_decoder_inst *di, |
| 888 | struct srd_term *term, gboolean *skip_allow) |
| 889 | { |
| 890 | uint8_t old_sample, sample; |
| 891 | int bit_offset, ch; |
| 892 | const uint8_t *sample_pos; |
| 893 | |
| 894 | /* Caller ensures di, di->dec_channelmap, term, sample_pos != NULL. */ |
| 895 | |
| 896 | *skip_allow = FALSE; |
| 897 | if (term->type == SRD_TERM_SKIP) { |
| 898 | if (di->abs_cur_matched && term->num_samples_to_skip == 0) |
| 899 | di->skip_zero = TRUE; |
| 900 | return sample_matches(0, 0, term); |
| 901 | } |
| 902 | |
| 903 | ch = term->channel; |
| 904 | if (*(di->inbuf + ch) == NULL) { |
| 905 | sample = *(di->inbuf_const + ch) ? 1 : 0; |
| 906 | *skip_allow = TRUE; |
| 907 | } else { |
| 908 | sample_pos = *(di->inbuf + ch) + ((di->abs_cur_samplenum - di->abs_start_samplenum) / 8); |
| 909 | bit_offset = (di->abs_cur_samplenum - di->abs_start_samplenum) % 8; |
| 910 | sample = *sample_pos & (1 << bit_offset) ? 1 : 0; |
| 911 | } |
| 912 | old_sample = di->old_pins_array->data[ch]; |
| 913 | |
| 914 | return sample_matches(old_sample, sample, term); |
| 915 | } |
| 916 | |
| 917 | static gboolean all_terms_match(struct srd_decoder_inst *di, |
| 918 | const GSList *cond, gboolean *skip_allow) |
no test coverage detected