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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 } | 889 } |
890 } | 890 } |
891 | 891 |
892 pcol_usage = opj_calloc(nr_channels, sizeof(OPJ_BOOL)); | 892 pcol_usage = opj_calloc(nr_channels, sizeof(OPJ_BOOL)); |
893 if (!pcol_usage) { | 893 if (!pcol_usage) { |
894 opj_event_msg(p_manager, EVT_ERROR, "Unexpected OOM.\n")
; | 894 opj_event_msg(p_manager, EVT_ERROR, "Unexpected OOM.\n")
; |
895 return OPJ_FALSE; | 895 return OPJ_FALSE; |
896 } | 896 } |
897 /* verify that no component is targeted more than once */ | 897 /* verify that no component is targeted more than once */ |
898 for (i = 0; i < nr_channels; i++) { | 898 for (i = 0; i < nr_channels; i++) { |
899 OPJ_UINT16 pcol = cmap[i].pcol; | 899 » » » if (cmap[i].mtyp != 0 && cmap[i].mtyp != 1) { |
900 assert(cmap[i].mtyp == 0 || cmap[i].mtyp == 1); | 900 » » » » opj_event_msg(p_manager, EVT_ERROR, "Unexpected
MTYP value.\n"); |
| 901 » » » » opj_free(pcol_usage); |
| 902 » » » » return OPJ_FALSE; |
| 903 » » » } |
| 904 » » » OPJ_UINT16 pcol = cmap[i].pcol; |
901 if (pcol >= nr_channels) { | 905 if (pcol >= nr_channels) { |
902 opj_event_msg(p_manager, EVT_ERROR, "Invalid com
ponent/palette index for direct mapping %d.\n", pcol); | 906 opj_event_msg(p_manager, EVT_ERROR, "Invalid com
ponent/palette index for direct mapping %d.\n", pcol); |
903 is_sane = OPJ_FALSE; | 907 is_sane = OPJ_FALSE; |
904 } | 908 } |
905 else if (pcol_usage[pcol] && cmap[i].mtyp != 0) { | 909 else if (pcol_usage[pcol] && cmap[i].mtyp != 0) { |
906 opj_event_msg(p_manager, EVT_ERROR, "Component %
d is mapped twice.\n", pcol); | 910 opj_event_msg(p_manager, EVT_ERROR, "Component %
d is mapped twice.\n", pcol); |
907 is_sane = OPJ_FALSE; | 911 is_sane = OPJ_FALSE; |
908 } | 912 } |
909 else if (cmap[i].mtyp == 0 && cmap[i].pcol != 0) { | 913 else if (cmap[i].mtyp == 0 && cmap[i].pcol != 0) { |
910 /* I.5.3.5 PCOL: If the value of the MTYP field for this channel is 0, t
hen | 914 /* I.5.3.5 PCOL: If the value of the MTYP field for this channel is 0, t
hen |
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 len = opj_stream_tell(cio)-lenp; | 3153 len = opj_stream_tell(cio)-lenp; |
3150 opj_stream_skip(cio, lenp, p_manager); | 3154 opj_stream_skip(cio, lenp, p_manager); |
3151 opj_write_bytes(l_data_header,len,4);/* L */ | 3155 opj_write_bytes(l_data_header,len,4);/* L */ |
3152 opj_stream_write_data(cio,l_data_header,4,p_manager); | 3156 opj_stream_write_data(cio,l_data_header,4,p_manager); |
3153 opj_stream_seek(cio, lenp+len,p_manager); | 3157 opj_stream_seek(cio, lenp+len,p_manager); |
3154 | 3158 |
3155 return len; | 3159 return len; |
3156 } | 3160 } |
3157 #endif | 3161 #endif |
3158 #endif /* USE_JPIP */ | 3162 #endif /* USE_JPIP */ |
OLD | NEW |