OLD | NEW |
1 /* | 1 /* |
2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
5 * are granted under this license. | 5 * are granted under this license. |
6 * | 6 * |
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium | 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium |
8 * Copyright (c) 2002-2014, Professor Benoit Macq | 8 * Copyright (c) 2002-2014, Professor Benoit Macq |
9 * Copyright (c) 2001-2003, David Janssens | 9 * Copyright (c) 2001-2003, David Janssens |
10 * Copyright (c) 2002-2003, Yannick Verschueren | 10 * Copyright (c) 2002-2003, Yannick Verschueren |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 /* initializations*/ | 809 /* initializations*/ |
810 tcp = &cp->tcps[tileno]; | 810 tcp = &cp->tcps[tileno]; |
811 l_poc_bound = tcp->numpocs+1; | 811 l_poc_bound = tcp->numpocs+1; |
812 | 812 |
813 /* memory allocations*/ | 813 /* memory allocations*/ |
814 l_pi = (opj_pi_iterator_t*) opj_calloc((l_poc_bound), sizeof(opj_pi_iter
ator_t)); | 814 l_pi = (opj_pi_iterator_t*) opj_calloc((l_poc_bound), sizeof(opj_pi_iter
ator_t)); |
815 if (!l_pi) { | 815 if (!l_pi) { |
816 return NULL; | 816 return NULL; |
817 } | 817 } |
818 memset(l_pi,0,l_poc_bound * sizeof(opj_pi_iterator_t)); | |
819 | 818 |
820 l_current_pi = l_pi; | 819 l_current_pi = l_pi; |
821 for (pino = 0; pino < l_poc_bound ; ++pino) { | 820 for (pino = 0; pino < l_poc_bound ; ++pino) { |
822 | 821 |
823 l_current_pi->comps = (opj_pi_comp_t*) opj_calloc(image->numcomp
s, sizeof(opj_pi_comp_t)); | 822 l_current_pi->comps = (opj_pi_comp_t*) opj_calloc(image->numcomp
s, sizeof(opj_pi_comp_t)); |
824 if (! l_current_pi->comps) { | 823 if (! l_current_pi->comps) { |
825 opj_pi_destroy(l_pi, l_poc_bound); | 824 opj_pi_destroy(l_pi, l_poc_bound); |
826 return NULL; | 825 return NULL; |
827 } | 826 } |
828 | 827 |
829 l_current_pi->numcomps = image->numcomps; | 828 l_current_pi->numcomps = image->numcomps; |
830 memset(l_current_pi->comps,0,image->numcomps * sizeof(opj_pi_com
p_t)); | |
831 | 829 |
832 for (compno = 0; compno < image->numcomps; ++compno) { | 830 for (compno = 0; compno < image->numcomps; ++compno) { |
833 opj_pi_comp_t *comp = &l_current_pi->comps[compno]; | 831 opj_pi_comp_t *comp = &l_current_pi->comps[compno]; |
834 | 832 |
835 tccp = &tcp->tccps[compno]; | 833 tccp = &tcp->tccps[compno]; |
836 | 834 |
837 » » » comp->resolutions = (opj_pi_resolution_t*) opj_malloc(tc
cp->numresolutions * sizeof(opj_pi_resolution_t)); | 835 » » » comp->resolutions = (opj_pi_resolution_t*) opj_calloc(tc
cp->numresolutions, sizeof(opj_pi_resolution_t)); |
838 if (!comp->resolutions) { | 836 if (!comp->resolutions) { |
839 opj_pi_destroy(l_pi, l_poc_bound); | 837 opj_pi_destroy(l_pi, l_poc_bound); |
840 return 00; | 838 return 00; |
841 } | 839 } |
842 | 840 |
843 comp->numresolutions = tccp->numresolutions; | 841 comp->numresolutions = tccp->numresolutions; |
844 memset(comp->resolutions,0,tccp->numresolutions * sizeof
(opj_pi_resolution_t)); | |
845 } | 842 } |
846 ++l_current_pi; | 843 ++l_current_pi; |
847 } | 844 } |
848 return l_pi; | 845 return l_pi; |
849 } | 846 } |
850 | 847 |
851 void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp, | 848 void opj_pi_update_encode_poc_and_final ( opj_cp_t *p_cp, |
852 OPJ_UINT32 p_tileno, | 849 OPJ_UINT32 p_tileno, |
853 OPJ_INT32 p_tx0, | 850 OPJ_INT32 p_tx0, |
854 OPJ_INT32 p_tx1, | 851 OPJ_INT32 p_tx1, |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 return OPJ_TRUE; | 1098 return OPJ_TRUE; |
1102 }else{ | 1099 }else{ |
1103 return OPJ_FALSE; | 1100 return OPJ_FALSE; |
1104 } | 1101 } |
1105 }else{ | 1102 }else{ |
1106 return OPJ_TRUE; | 1103 return OPJ_TRUE; |
1107 } | 1104 } |
1108 break; | 1105 break; |
1109 case 'P': | 1106 case 'P': |
1110 switch(tcp->prg){ | 1107 switch(tcp->prg){ |
1111 » » » » case OPJ_LRCP||OPJ_RLCP: | 1108 case OPJ_LRCP: // fall through |
| 1109 case OPJ_RLCP: |
1112 if(tcp->prc_t == tcp->prcE){ | 1110 if(tcp->prc_t == tcp->prcE){ |
1113 if(opj_pi_check_next_level(i
-1,cp,tileno,pino,prog)){ | 1111 if(opj_pi_check_next_level(i
-1,cp,tileno,pino,prog)){ |
1114 return OPJ_TRUE; | 1112 return OPJ_TRUE; |
1115 }else{ | 1113 }else{ |
1116 return OPJ_FALSE; | 1114 return OPJ_FALSE; |
1117 } | 1115 } |
1118 }else{ | 1116 }else{ |
1119 return OPJ_TRUE; | 1117 return OPJ_TRUE; |
1120 } | 1118 } |
1121 break; | 1119 break; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 /* memory allocation for include */ | 1233 /* memory allocation for include */ |
1236 l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) *
l_step_l, sizeof(OPJ_INT16)); | 1234 l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) *
l_step_l, sizeof(OPJ_INT16)); |
1237 if | 1235 if |
1238 (!l_current_pi->include) | 1236 (!l_current_pi->include) |
1239 { | 1237 { |
1240 opj_free(l_tmp_data); | 1238 opj_free(l_tmp_data); |
1241 opj_free(l_tmp_ptr); | 1239 opj_free(l_tmp_ptr); |
1242 opj_pi_destroy(l_pi, l_bound); | 1240 opj_pi_destroy(l_pi, l_bound); |
1243 return 00; | 1241 return 00; |
1244 } | 1242 } |
1245 memset(l_current_pi->include,0, (l_tcp->numlayers + 1) * l_step_l* sizeo
f(OPJ_INT16)); | |
1246 | 1243 |
1247 /* special treatment for the first packet iterator */ | 1244 /* special treatment for the first packet iterator */ |
1248 l_current_comp = l_current_pi->comps; | 1245 l_current_comp = l_current_pi->comps; |
1249 l_img_comp = p_image->comps; | 1246 l_img_comp = p_image->comps; |
1250 l_tccp = l_tcp->tccps; | 1247 l_tccp = l_tcp->tccps; |
1251 | 1248 |
1252 l_current_pi->tx0 = l_tx0; | 1249 l_current_pi->tx0 = l_tx0; |
1253 l_current_pi->ty0 = l_ty0; | 1250 l_current_pi->ty0 = l_ty0; |
1254 l_current_pi->tx1 = l_tx1; | 1251 l_current_pi->tx1 = l_tx1; |
1255 l_current_pi->ty1 = l_ty1; | 1252 l_current_pi->ty1 = l_ty1; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 l_current_pi = l_pi; | 1429 l_current_pi = l_pi; |
1433 | 1430 |
1434 /* memory allocation for include*/ | 1431 /* memory allocation for include*/ |
1435 l_current_pi->include = (OPJ_INT16*) opj_calloc(l_tcp->numlayers * l_ste
p_l, sizeof(OPJ_INT16)); | 1432 l_current_pi->include = (OPJ_INT16*) opj_calloc(l_tcp->numlayers * l_ste
p_l, sizeof(OPJ_INT16)); |
1436 if (!l_current_pi->include) { | 1433 if (!l_current_pi->include) { |
1437 opj_free(l_tmp_data); | 1434 opj_free(l_tmp_data); |
1438 opj_free(l_tmp_ptr); | 1435 opj_free(l_tmp_ptr); |
1439 opj_pi_destroy(l_pi, l_bound); | 1436 opj_pi_destroy(l_pi, l_bound); |
1440 return 00; | 1437 return 00; |
1441 } | 1438 } |
1442 memset(l_current_pi->include,0,l_tcp->numlayers * l_step_l* sizeof(OPJ_I
NT16)); | |
1443 | 1439 |
1444 /* special treatment for the first packet iterator*/ | 1440 /* special treatment for the first packet iterator*/ |
1445 l_current_comp = l_current_pi->comps; | 1441 l_current_comp = l_current_pi->comps; |
1446 l_img_comp = p_image->comps; | 1442 l_img_comp = p_image->comps; |
1447 l_tccp = l_tcp->tccps; | 1443 l_tccp = l_tcp->tccps; |
1448 l_current_pi->tx0 = l_tx0; | 1444 l_current_pi->tx0 = l_tx0; |
1449 l_current_pi->ty0 = l_ty0; | 1445 l_current_pi->ty0 = l_ty0; |
1450 l_current_pi->tx1 = l_tx1; | 1446 l_current_pi->tx1 = l_tx1; |
1451 l_current_pi->ty1 = l_ty1; | 1447 l_current_pi->ty1 = l_ty1; |
1452 l_current_pi->dx = l_dx_min; | 1448 l_current_pi->dx = l_dx_min; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 /* special treatment*/ | 1514 /* special treatment*/ |
1519 l_current_pi->include = (l_current_pi-1)->include; | 1515 l_current_pi->include = (l_current_pi-1)->include; |
1520 ++l_current_pi; | 1516 ++l_current_pi; |
1521 } | 1517 } |
1522 | 1518 |
1523 opj_free(l_tmp_data); | 1519 opj_free(l_tmp_data); |
1524 l_tmp_data = 00; | 1520 l_tmp_data = 00; |
1525 opj_free(l_tmp_ptr); | 1521 opj_free(l_tmp_ptr); |
1526 l_tmp_ptr = 00; | 1522 l_tmp_ptr = 00; |
1527 | 1523 |
1528 » if (l_tcp->POC && ( p_cp->m_specific_param.m_enc.m_cinema || p_t2_mode =
= FINAL_PASS)) { | 1524 if (l_tcp->POC && (OPJ_IS_CINEMA(p_cp->rsiz) || p_t2_mode == FINAL_PASS)) { |
1529 opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_
ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); | 1525 opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_
ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); |
1530 } | 1526 } |
1531 else { | 1527 else { |
1532 opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_
tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); | 1528 opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_
tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); |
1533 } | 1529 } |
1534 | 1530 |
1535 return l_pi; | 1531 return l_pi; |
1536 } | 1532 } |
1537 | 1533 |
1538 void opj_pi_create_encode( opj_pi_iterator_t *pi, | 1534 void opj_pi_create_encode( opj_pi_iterator_t *pi, |
1539 opj_cp_t *cp, | 1535 opj_cp_t *cp, |
1540 OPJ_UINT32 tileno, | 1536 OPJ_UINT32 tileno, |
1541 OPJ_UINT32 pino, | 1537 OPJ_UINT32 pino, |
1542 OPJ_UINT32 tpnum, | 1538 OPJ_UINT32 tpnum, |
1543 OPJ_INT32 tppos, | 1539 OPJ_INT32 tppos, |
1544 J2K_T2_MODE t2_mode) | 1540 J2K_T2_MODE t2_mode) |
1545 { | 1541 { |
1546 const OPJ_CHAR *prog; | 1542 const OPJ_CHAR *prog; |
1547 OPJ_INT32 i; | 1543 OPJ_INT32 i; |
1548 OPJ_UINT32 incr_top=1,resetX=0; | 1544 OPJ_UINT32 incr_top=1,resetX=0; |
1549 opj_tcp_t *tcps =&cp->tcps[tileno]; | 1545 opj_tcp_t *tcps =&cp->tcps[tileno]; |
1550 opj_poc_t *tcp= &tcps->pocs[pino]; | 1546 opj_poc_t *tcp= &tcps->pocs[pino]; |
1551 | 1547 |
1552 prog = opj_j2k_convert_progression_order(tcp->prg); | 1548 prog = opj_j2k_convert_progression_order(tcp->prg); |
1553 | 1549 |
1554 pi[pino].first = 1; | 1550 pi[pino].first = 1; |
1555 pi[pino].poc.prg = tcp->prg; | 1551 pi[pino].poc.prg = tcp->prg; |
1556 | 1552 |
1557 » if(!(cp->m_specific_param.m_enc.m_tp_on && ((!cp->m_specific_param.m_enc
.m_cinema && (t2_mode == FINAL_PASS)) || cp->m_specific_param.m_enc.m_cinema))){ | 1553 if(!(cp->m_specific_param.m_enc.m_tp_on && ((!OPJ_IS_CINEMA(cp->rsiz) && (t2
_mode == FINAL_PASS)) || OPJ_IS_CINEMA(cp->rsiz)))){ |
1558 pi[pino].poc.resno0 = tcp->resS; | 1554 pi[pino].poc.resno0 = tcp->resS; |
1559 pi[pino].poc.resno1 = tcp->resE; | 1555 pi[pino].poc.resno1 = tcp->resE; |
1560 pi[pino].poc.compno0 = tcp->compS; | 1556 pi[pino].poc.compno0 = tcp->compS; |
1561 pi[pino].poc.compno1 = tcp->compE; | 1557 pi[pino].poc.compno1 = tcp->compE; |
1562 pi[pino].poc.layno0 = tcp->layS; | 1558 pi[pino].poc.layno0 = tcp->layS; |
1563 pi[pino].poc.layno1 = tcp->layE; | 1559 pi[pino].poc.layno1 = tcp->layE; |
1564 pi[pino].poc.precno0 = tcp->prcS; | 1560 pi[pino].poc.precno0 = tcp->prcS; |
1565 pi[pino].poc.precno1 = tcp->prcE; | 1561 pi[pino].poc.precno1 = tcp->prcE; |
1566 pi[pino].poc.tx0 = (OPJ_INT32)tcp->txS; | 1562 pi[pino].poc.tx0 = (OPJ_INT32)tcp->txS; |
1567 pi[pino].poc.ty0 = (OPJ_INT32)tcp->tyS; | 1563 pi[pino].poc.ty0 = (OPJ_INT32)tcp->tyS; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 case OPJ_PCRL: | 1863 case OPJ_PCRL: |
1868 return opj_pi_next_pcrl(pi); | 1864 return opj_pi_next_pcrl(pi); |
1869 case OPJ_CPRL: | 1865 case OPJ_CPRL: |
1870 return opj_pi_next_cprl(pi); | 1866 return opj_pi_next_cprl(pi); |
1871 case OPJ_PROG_UNKNOWN: | 1867 case OPJ_PROG_UNKNOWN: |
1872 return OPJ_FALSE; | 1868 return OPJ_FALSE; |
1873 } | 1869 } |
1874 | 1870 |
1875 return OPJ_FALSE; | 1871 return OPJ_FALSE; |
1876 } | 1872 } |
OLD | NEW |