Unified · Split
| @@ -49,6 +49,7 @@ version <next>: · 48 unmodified lines | |||
| 49 | - SpeedHQ encoder | 49 | - SpeedHQ encoder |
| 50 | - asupercut filter | 50 | - asupercut filter |
| 51 | - asubcut filter | 51 | - asubcut filter |
| 52 | - Microsoft Paint (MSP) version 2 decoder | ||
| 52 | 53 | ||
| 53 | 54 | ||
| 54 | version 4.3: | 55 | version 4.3: |
| @@ -508,6 +508,7 @@ OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o · 507 unmodified lines | |||
| 508 | OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o | 508 | OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o |
| 509 | OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o | 509 | OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4dec.o msmpeg4.o msmpeg4data.o |
| 510 | OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o | 510 | OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4enc.o msmpeg4.o msmpeg4data.o |
| 511 | OBJS-$(CONFIG_MSP2_DECODER) += msp2dec.o | ||
| 511 | OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o | 512 | OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o |
| 512 | OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o | 513 | OBJS-$(CONFIG_MSS1_DECODER) += mss1.o mss12.o |
| 513 | OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o wmv2data.o | 514 | OBJS-$(CONFIG_MSS2_DECODER) += mss2.o mss12.o mss2dsp.o wmv2data.o |
| @@ -215,6 +215,7 @@ extern AVCodec ff_msmpeg4v2_decoder; · 214 unmodified lines | |||
| 215 | extern AVCodec ff_msmpeg4v3_encoder; | 215 | extern AVCodec ff_msmpeg4v3_encoder; |
| 216 | extern AVCodec ff_msmpeg4v3_decoder; | 216 | extern AVCodec ff_msmpeg4v3_decoder; |
| 217 | extern AVCodec ff_msmpeg4_crystalhd_decoder; | 217 | extern AVCodec ff_msmpeg4_crystalhd_decoder; |
| 218 | extern AVCodec ff_msp2_decoder; | ||
| 218 | extern AVCodec ff_msrle_decoder; | 219 | extern AVCodec ff_msrle_decoder; |
| 219 | extern AVCodec ff_mss1_decoder; | 220 | extern AVCodec ff_mss1_decoder; |
| 220 | extern AVCodec ff_mss2_decoder; | 221 | extern AVCodec ff_mss2_decoder; |
| @@ -1419,6 +1419,13 @@ static const AVCodecDescriptor codec_descriptors[] = { · 1418 unmodified lines | |||
| 1419 | .long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"), | 1419 | .long_name = NULL_IF_CONFIG_SMALL("AVS3-P2/IEEE1857.10"), |
| 1420 | .props = AV_CODEC_PROP_LOSSY, | 1420 | .props = AV_CODEC_PROP_LOSSY, |
| 1421 | }, | 1421 | }, |
| 1422 | { | ||
| 1423 | .id = AV_CODEC_ID_MSP2, | ||
| 1424 | .type = AVMEDIA_TYPE_VIDEO, | ||
| 1425 | .name = "msp2", | ||
| 1426 | .long_name = NULL_IF_CONFIG_SMALL("Microsoft Paint (MSP) version 2"), | ||
| 1427 | .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, | ||
| 1428 | }, | ||
| 1422 | { | 1429 | { |
| 1423 | .id = AV_CODEC_ID_Y41P, | 1430 | .id = AV_CODEC_ID_Y41P, |
| 1424 | .type = AVMEDIA_TYPE_VIDEO, | 1431 | .type = AVMEDIA_TYPE_VIDEO, |
| @@ -243,6 +243,7 @@ enum AVCodecID { · 242 unmodified lines | |||
| 243 | AV_CODEC_ID_AVS2, | 243 | AV_CODEC_ID_AVS2, |
| 244 | AV_CODEC_ID_PGX, | 244 | AV_CODEC_ID_PGX, |
| 245 | AV_CODEC_ID_AVS3, | 245 | AV_CODEC_ID_AVS3, |
| 246 | AV_CODEC_ID_MSP2, | ||
| 246 | 247 | ||
| 247 | AV_CODEC_ID_Y41P = 0x8000, | 248 | AV_CODEC_ID_Y41P = 0x8000, |
| 248 | AV_CODEC_ID_AVRP, | 249 | AV_CODEC_ID_AVRP, |
| @@ -0,0 +1,102 @@ | |||
| 1 | /* | ||
| 2 | * Microsoft Paint (MSP) version 2 decoder | ||
| 3 | * Copyright (c) 2020 Peter Ross (pross@xvid.org) | ||
| 4 | * | ||
| 5 | * This file is part of FFmpeg. | ||
| 6 | * | ||
| 7 | * FFmpeg is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * Lesser General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public | ||
| 18 | * License along with FFmpeg; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | /** | ||
| 23 | * @file | ||
| 24 | * Microsoft Paint (MSP) version 2 decoder | ||
| 25 | */ | ||
| 26 | |||
| 27 | #include "avcodec.h" | ||
| 28 | #include "bytestream.h" | ||
| 29 | #include "internal.h" | ||
| 30 | |||
| 31 | static int msp2_decode_frame(AVCodecContext *avctx, | ||
| 32 | void *data, int *got_frame, | ||
| 33 | AVPacket *avpkt) | ||
| 34 | { | ||
| 35 | const uint8_t *buf = avpkt->data; | ||
| 36 | int buf_size = avpkt->size; | ||
| 37 | AVFrame *p = data; | ||
| 38 | int ret; | ||
| 39 | unsigned int x, y, width = (avctx->width + 7) / 8; | ||
| 40 | GetByteContext idx, gb; | ||
| 41 | |||
| 42 | if (buf_size <= 2 * avctx->height) | ||
| 43 | return AVERROR_INVALIDDATA; | ||
| 44 | |||
| 45 | avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; | ||
| 46 | |||
| 47 | if ((ret = ff_get_buffer(avctx, p, 0)) < 0) | ||
| 48 | return ret; | ||
| 49 | |||
| 50 | p->pict_type = AV_PICTURE_TYPE_I; | ||
| 51 | p->key_frame = 1; | ||
| 52 | |||
| 53 | bytestream2_init(&idx, buf, 2 * avctx->height); | ||
| 54 | buf += 2 * avctx->height; | ||
| 55 | buf_size -= 2 * avctx->height; | ||
| 56 | |||
| 57 | for (y = 0; y < avctx->height; y++) { | ||
| 58 | unsigned int pkt_size = bytestream2_get_le16(&idx); | ||
| 59 | if (!pkt_size) { | ||
| 60 | memset(p->data[0] + y * p->linesize[0], 0xFF, width); | ||
| 61 | continue; | ||
| 62 | } | ||
| 63 | |||
| 64 | if (pkt_size > buf_size) { | ||
| 65 | av_log(avctx, AV_LOG_WARNING, "image probably corrupt\n"); | ||
| 66 | pkt_size = buf_size; | ||
| 67 | } | ||
| 68 | |||
| 69 | bytestream2_init(&gb, buf, pkt_size); | ||
| 70 | x = 0; | ||
| 71 | while (bytestream2_get_bytes_left(&gb) && x < width) { | ||
| 72 | int size = bytestream2_get_byte(&gb); | ||
| 73 | if (size) { | ||
| 74 | memcpy(p->data[0] + y * p->linesize[0] + x, gb.buffer, FFMIN(size, width - x)); | ||
| 75 | bytestream2_skip(&gb, size); | ||
| 76 | } else { | ||
| 77 | int value; | ||
| 78 | size = bytestream2_get_byte(&gb); | ||
| 79 | if (!size) | ||
| 80 | avpriv_request_sample(avctx, "escape value"); | ||
| 81 | value = bytestream2_get_byte(&gb); | ||
| 82 | memset(p->data[0] + y * p->linesize[0] + x, value, FFMIN(size, width - x)); | ||
| 83 | } | ||
| 84 | x += size; | ||
| 85 | } | ||
| 86 | |||
| 87 | buf += pkt_size; | ||
| 88 | buf_size -= pkt_size; | ||
| 89 | } | ||
| 90 | |||
| 91 | *got_frame = 1; | ||
| 92 | return buf_size; | ||
| 93 | } | ||
| 94 | |||
| 95 | AVCodec ff_msp2_decoder = { | ||
| 96 | .name = "msp2", | ||
| 97 | .long_name = NULL_IF_CONFIG_SMALL("Microsoft Paint (MSP) version 2"), | ||
| 98 | .type = AVMEDIA_TYPE_VIDEO, | ||
| 99 | .id = AV_CODEC_ID_MSP2, | ||
| 100 | .decode = msp2_decode_frame, | ||
| 101 | .capabilities = AV_CODEC_CAP_DR1, | ||
| 102 | }; | ||
| @@ -28,7 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "libavutil/version.h" | 28 | #include "libavutil/version.h" |
| 29 | 29 | ||
| 30 | #define LIBAVCODEC_VERSION_MAJOR 58 | 30 | #define LIBAVCODEC_VERSION_MAJOR 58 |
| 31 | #define LIBAVCODEC_VERSION_MINOR 114 | 31 | #define LIBAVCODEC_VERSION_MINOR 115 |
| 32 | #define LIBAVCODEC_VERSION_MICRO 100 | 32 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 33 | 33 | ||
| 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | 34 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |