| 1582 | dst= tmp; |
| 1583 | |
| 1584 | static int decode_header(SnowContext *s){ |
| 1585 | int plane_index, tmp; |
| 1586 | uint8_t kstate[32]; |
| 1587 | |
| 1588 | memset(kstate, MID_STATE, sizeof(kstate)); |
| 1589 | |
| 1590 | s->keyframe= get_rac(&s->c, kstate); |
| 1591 | if(s->keyframe || s->always_reset){ |
| 1592 | reset_contexts(s); |
| 1593 | s->spatial_decomposition_type= |
| 1594 | s->qlog= |
| 1595 | s->qbias= |
| 1596 | s->mv_scale= |
| 1597 | s->block_max_depth= 0; |
| 1598 | } |
| 1599 | if(s->keyframe){ |
| 1600 | GET_S(s->version, tmp <= 0U) |
| 1601 | s->always_reset= get_rac(&s->c, s->header_state); |
| 1602 | s->temporal_decomposition_type= get_symbol(&s->c, s->header_state, 0); |
| 1603 | s->temporal_decomposition_count= get_symbol(&s->c, s->header_state, 0); |
| 1604 | GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS) |
| 1605 | s->colorspace_type= get_symbol(&s->c, s->header_state, 0); |
| 1606 | s->chroma_h_shift= get_symbol(&s->c, s->header_state, 0); |
| 1607 | s->chroma_v_shift= get_symbol(&s->c, s->header_state, 0); |
| 1608 | s->spatial_scalability= get_rac(&s->c, s->header_state); |
| 1609 | // s->rate_scalability= get_rac(&s->c, s->header_state); |
| 1610 | GET_S(s->max_ref_frames, tmp < (unsigned)MAX_REF_FRAMES) |
| 1611 | s->max_ref_frames++; |
| 1612 | |
| 1613 | decode_qlogs(s); |
| 1614 | } |
| 1615 | |
| 1616 | if(!s->keyframe){ |
| 1617 | if(get_rac(&s->c, s->header_state)){ |
| 1618 | for(plane_index=0; plane_index<2; plane_index++){ |
| 1619 | int htaps, i, sum=0; |
| 1620 | Plane *p= &s->plane[plane_index]; |
| 1621 | p->diag_mc= get_rac(&s->c, s->header_state); |
| 1622 | htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2; |
| 1623 | if((unsigned)htaps > HTAPS_MAX || htaps==0) |
| 1624 | return -1; |
| 1625 | p->htaps= htaps; |
| 1626 | for(i= htaps/2; i; i--){ |
| 1627 | p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1)); |
| 1628 | sum += p->hcoeff[i]; |
| 1629 | } |
| 1630 | p->hcoeff[0]= 32-sum; |
| 1631 | } |
| 1632 | s->plane[2].diag_mc= s->plane[1].diag_mc; |
| 1633 | s->plane[2].htaps = s->plane[1].htaps; |
| 1634 | memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff)); |
| 1635 | } |
| 1636 | if(get_rac(&s->c, s->header_state)){ |
| 1637 | GET_S(s->spatial_decomposition_count, 0 < tmp && tmp <= MAX_DECOMPOSITIONS) |
| 1638 | decode_qlogs(s); |
| 1639 | } |
| 1640 | } |
| 1641 |
no test coverage detected