| OLD | NEW |
| 1 /* | 1 /* |
| 2 * JPEG 2000 decoding support via OpenJPEG | 2 * JPEG 2000 decoding support via OpenJPEG |
| 3 * Copyright (c) 2009 Jaikrishnan Menon <realityman@gmx.net> | 3 * Copyright (c) 2009 Jaikrishnan Menon <realityman@gmx.net> |
| 4 * | 4 * |
| 5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
| 6 * | 6 * |
| 7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Decode the codestream | 107 // Decode the codestream |
| 108 image = opj_decode_with_info(dec, stream, NULL); | 108 image = opj_decode_with_info(dec, stream, NULL); |
| 109 opj_cio_close(stream); | 109 opj_cio_close(stream); |
| 110 if(!image) { | 110 if(!image) { |
| 111 av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n"); | 111 av_log(avctx, AV_LOG_ERROR, "Error decoding codestream.\n"); |
| 112 opj_destroy_decompress(dec); | 112 opj_destroy_decompress(dec); |
| 113 return -1; | 113 return -1; |
| 114 } | 114 } |
| 115 width = image->comps[0].w << avctx->lowres; | 115 width = image->comps[0].w << avctx->lowres; |
| 116 height = image->comps[0].h << avctx->lowres; | 116 height = image->comps[0].h << avctx->lowres; |
| 117 if(av_check_image_size(width, height, 0, avctx) < 0) { | 117 if(av_image_check_size(width, height, 0, avctx) < 0) { |
| 118 av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height)
; | 118 av_log(avctx, AV_LOG_ERROR, "%dx%d dimension invalid.\n", width, height)
; |
| 119 goto done; | 119 goto done; |
| 120 } | 120 } |
| 121 avcodec_set_dimensions(avctx, width, height); | 121 avcodec_set_dimensions(avctx, width, height); |
| 122 | 122 |
| 123 switch(image->numcomps) | 123 switch(image->numcomps) |
| 124 { | 124 { |
| 125 case 1: avctx->pix_fmt = PIX_FMT_GRAY8; | 125 case 1: avctx->pix_fmt = PIX_FMT_GRAY8; |
| 126 break; | 126 break; |
| 127 case 3: if(check_image_attributes(image)) { | 127 case 3: if(check_image_attributes(image)) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 CODEC_ID_JPEG2000, | 190 CODEC_ID_JPEG2000, |
| 191 sizeof(LibOpenJPEGContext), | 191 sizeof(LibOpenJPEGContext), |
| 192 libopenjpeg_decode_init, | 192 libopenjpeg_decode_init, |
| 193 NULL, | 193 NULL, |
| 194 libopenjpeg_decode_close, | 194 libopenjpeg_decode_close, |
| 195 libopenjpeg_decode_frame, | 195 libopenjpeg_decode_frame, |
| 196 CODEC_CAP_DR1, | 196 CODEC_CAP_DR1, |
| 197 .max_lowres = 5, | 197 .max_lowres = 5, |
| 198 .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"), | 198 .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"), |
| 199 } ; | 199 } ; |
| OLD | NEW |