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) 2005, Herve Drolon, FreeImage Team | 7 * Copyright (c) 2005, Herve Drolon, FreeImage Team |
8 * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR | 8 * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR |
9 * Copyright (c) 2012, CS Systemes d'Information, France | 9 * Copyright (c) 2012, CS Systemes d'Information, France |
10 * All rights reserved. | 10 * All rights reserved. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 l_codec = (opj_codec_private_t*) opj_calloc(1, sizeof(opj_codec_private_ t)); | 168 l_codec = (opj_codec_private_t*) opj_calloc(1, sizeof(opj_codec_private_ t)); |
169 if (!l_codec){ | 169 if (!l_codec){ |
170 return 00; | 170 return 00; |
171 } | 171 } |
172 memset(l_codec, 0, sizeof(opj_codec_private_t)); | 172 memset(l_codec, 0, sizeof(opj_codec_private_t)); |
173 | 173 |
174 l_codec->is_decompressor = 1; | 174 l_codec->is_decompressor = 1; |
175 | 175 |
176 switch (p_format) { | 176 switch (p_format) { |
177 case OPJ_CODEC_J2K: | 177 case OPJ_CODEC_J2K: |
178 l_codec->opj_dump_codec = (void (*) (void*, OPJ_INT32, F ILE*)) j2k_dump; | 178 l_codec->opj_dump_codec = (void (*) (void*, OPJ_INT32, F ILE*)) j2k_dump; |
Tom Sepez
2014/09/24 22:33:55
FYI: Theoretically, all these casts are illegal.
| |
179 | 179 |
180 l_codec->opj_get_codec_info = (opj_codestream_info_v2_t* (*) (void*) ) j2k_get_cstr_info; | 180 l_codec->opj_get_codec_info = (opj_codestream_info_v2_t* (*) (void*) ) j2k_get_cstr_info; |
181 | 181 |
182 l_codec->opj_get_codec_index = (opj_codestream_index_t* (*) (void*) ) j2k_get_cstr_index; | 182 l_codec->opj_get_codec_index = (opj_codestream_index_t* (*) (void*) ) j2k_get_cstr_index; |
183 | 183 |
184 l_codec->m_codec_data.m_decompression.opj_decode = | 184 l_codec->m_codec_data.m_decompression.opj_decode = |
185 (OPJ_BOOL (*) ( void *, | 185 (OPJ_BOOL (*) ( void *, |
186 struct o pj_stream_private *, | 186 struct o pj_stream_private *, |
187 opj_imag e_t*, struct opj_event_mgr * )) opj_j2k_decode; | 187 opj_imag e_t*, struct opj_event_mgr * )) opj_j2k_decode; |
188 | 188 |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 | 567 |
568 l_codec->m_codec_data.m_compression.opj_write_tile = (OP J_BOOL (*) (void *, | 568 l_codec->m_codec_data.m_compression.opj_write_tile = (OP J_BOOL (*) (void *, |
569 OPJ_UINT32, | 569 OPJ_UINT32, |
570 OPJ_BYTE*, | 570 OPJ_BYTE*, |
571 OPJ_UINT32, | 571 OPJ_UINT32, |
572 struct opj_stream_private *, | 572 struct opj_stream_private *, |
573 struct opj_event_mgr *) ) opj_j2k_write_tile; | 573 struct opj_event_mgr *) ) opj_j2k_write_tile; |
574 | 574 |
575 l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_j2k_destroy; | 575 l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_j2k_destroy; |
576 | 576 |
577 » » » l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) (» void *, | 577 » » » l_codec->m_codec_data.m_compression.opj_setup_encoder = (OPJ_BOOL (*) (»void *, |
578 opj_cparameters_t *, | 578 opj_cparameters_t *, |
579 struct opj_image *, | 579 struct opj_image *, |
580 struct opj_event_mgr * )) opj_j2k_setup_encoder; | 580 struct opj_event_mgr * )) opj_j2k_setup_encoder; |
581 | 581 |
582 l_codec->m_codec = opj_j2k_create_compress(); | 582 l_codec->m_codec = opj_j2k_create_compress(); |
583 if (! l_codec->m_codec) { | 583 if (! l_codec->m_codec) { |
584 opj_free(l_codec); | 584 opj_free(l_codec); |
585 return 00; | 585 return 00; |
586 } | 586 } |
587 | 587 |
(...skipping 16 matching lines...) Expand all Loading... | |
604 | 604 |
605 l_codec->m_codec_data.m_compression.opj_write_tile = (OP J_BOOL (*) (void *, | 605 l_codec->m_codec_data.m_compression.opj_write_tile = (OP J_BOOL (*) (void *, |
606 OPJ_UINT32, | 606 OPJ_UINT32, |
607 OPJ_BYTE*, | 607 OPJ_BYTE*, |
608 OPJ_UINT32, | 608 OPJ_UINT32, |
609 struct opj_stream_private *, | 609 struct opj_stream_private *, |
610 struct opj_event_mgr *)) opj_jp2_write_tile; | 610 struct opj_event_mgr *)) opj_jp2_write_tile; |
611 | 611 |
612 l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_jp2_destroy; | 612 l_codec->m_codec_data.m_compression.opj_destroy = (void (*) (void *)) opj_jp2_destroy; |
613 | 613 |
614 » » » l_codec->m_codec_data.m_compression.opj_setup_encoder = (void (*) (» void *, | 614 » » » l_codec->m_codec_data.m_compression.opj_setup_encoder = (OPJ_BOOL (*) (»void *, |
615 opj_cparameters_t *, | 615 opj_cparameters_t *, |
616 struct opj_image *, | 616 struct opj_image *, |
617 struct opj_event_mgr * )) opj_jp2_setup_encoder; | 617 struct opj_event_mgr * )) opj_jp2_setup_encoder; |
618 | 618 |
619 l_codec->m_codec = opj_jp2_create(OPJ_FALSE); | 619 l_codec->m_codec = opj_jp2_create(OPJ_FALSE); |
620 if (! l_codec->m_codec) { | 620 if (! l_codec->m_codec) { |
621 opj_free(l_codec); | 621 opj_free(l_codec); |
622 return 00; | 622 return 00; |
623 } | 623 } |
624 | 624 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
951 | 951 |
952 opj_stream_set_user_data_v3(l_stream, p_file, (opj_stream_free_user_data_fn) fclose); | 952 opj_stream_set_user_data_v3(l_stream, p_file, (opj_stream_free_user_data_fn) fclose); |
953 opj_stream_set_user_data_length(l_stream, opj_get_data_length_from_file(p_fi le)); | 953 opj_stream_set_user_data_length(l_stream, opj_get_data_length_from_file(p_fi le)); |
954 opj_stream_set_read_function(l_stream, (opj_stream_read_fn) opj_read_from_fi le); | 954 opj_stream_set_read_function(l_stream, (opj_stream_read_fn) opj_read_from_fi le); |
955 opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from _file); | 955 opj_stream_set_write_function(l_stream, (opj_stream_write_fn) opj_write_from _file); |
956 opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_fi le); | 956 opj_stream_set_skip_function(l_stream, (opj_stream_skip_fn) opj_skip_from_fi le); |
957 opj_stream_set_seek_function(l_stream, (opj_stream_seek_fn) opj_seek_from_fi le); | 957 opj_stream_set_seek_function(l_stream, (opj_stream_seek_fn) opj_seek_from_fi le); |
958 | 958 |
959 return l_stream; | 959 return l_stream; |
960 } | 960 } |
OLD | NEW |