mirror of https://git.ffmpeg.org/ffmpeg.git
Merge commit '07761294fc3f08e139e8a406ef7d5b63aaf1ecee'
* commit '07761294fc3f08e139e8a406ef7d5b63aaf1ecee':
Silicon Graphics RLE 8-bit video decoder
Conflicts:
Changelog
doc/general.texi
libavcodec/avcodec.h
libavcodec/sgirledec.c
libavcodec/version.h
See: afa1617b93
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
e37dbfddda
|
@ -236,7 +236,7 @@ version 1.1:
|
|||
- JSON captions for TED talks decoding support
|
||||
- SOX Resampler support in libswresample
|
||||
- aselect filter
|
||||
- SGI RLE 8-bit decoder
|
||||
- SGI RLE 8-bit / Silicon Graphics RLE 8-bit video decoder
|
||||
- Silicon Graphics Motion Video Compressor 1 & 2 decoder
|
||||
- Silicon Graphics Movie demuxer
|
||||
- apad filter
|
||||
|
|
|
@ -752,11 +752,11 @@ following image formats are supported:
|
|||
@tab Texture dictionaries used by the Renderware Engine.
|
||||
@item RL2 video @tab @tab X
|
||||
@tab used in some games by Entertainment Software Partners
|
||||
@item SGI RLE 8-bit @tab @tab X
|
||||
@item Sierra VMD video @tab @tab X
|
||||
@tab Used in Sierra VMD files.
|
||||
@item Silicon Graphics Motion Video Compressor 1 (MVC1) @tab @tab X
|
||||
@item Silicon Graphics Motion Video Compressor 2 (MVC2) @tab @tab X
|
||||
@item Silicon Graphics RLE 8-bit video @tab @tab X
|
||||
@item Smacker video @tab @tab X
|
||||
@tab Video encoding used in Smacker.
|
||||
@item SMPTE VC-1 @tab @tab X
|
||||
|
|
|
@ -292,6 +292,7 @@ enum AVCodecID {
|
|||
AV_CODEC_ID_EXR_DEPRECATED,
|
||||
AV_CODEC_ID_VP7_DEPRECATED,
|
||||
AV_CODEC_ID_SANM_DEPRECATED,
|
||||
AV_CODEC_ID_SGIRLE_DEPRECATED,
|
||||
|
||||
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
|
||||
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
|
||||
|
|
|
@ -661,13 +661,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
|||
.long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
|
||||
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
|
||||
},
|
||||
{
|
||||
.id = AV_CODEC_ID_SGIRLE,
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.name = "sgirle",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"),
|
||||
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
|
||||
},
|
||||
{
|
||||
.id = AV_CODEC_ID_C93,
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
|
@ -1233,6 +1226,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
|||
.long_name = NULL_IF_CONFIG_SMALL("LucasArts SANM/SMUSH video"),
|
||||
.props = AV_CODEC_PROP_LOSSY,
|
||||
},
|
||||
{
|
||||
.id = AV_CODEC_ID_SGIRLE,
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.name = "sgirle",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"),
|
||||
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
|
||||
},
|
||||
|
||||
/* image codecs */
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SGI RLE 8-bit decoder
|
||||
* Silicon Graphics RLE 8-bit video decoder
|
||||
* Copyright (c) 2012 Peter Ross
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
|
@ -21,9 +21,13 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* SGI RLE 8-bit decoder
|
||||
* Silicon Graphics RLE 8-bit video decoder
|
||||
* @note Data is packed in rbg323 with rle, contained in mv or mov.
|
||||
* The algorithm and pixfmt are subtly different from SGI images.
|
||||
*/
|
||||
|
||||
#include "libavutil/common.h"
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
@ -42,16 +46,18 @@ static av_cold int sgirle_decode_init(AVCodecContext *avctx)
|
|||
}
|
||||
|
||||
/**
|
||||
* Convert SGI RGB332 pixel into AV_PIX_FMT_BGR8
|
||||
* SGI RGB332 is packed RGB 3:3:2, 8bpp, (msb)3R 2B 3G(lsb)
|
||||
* Convert SGI RBG323 pixel into AV_PIX_FMT_BGR8
|
||||
* SGI RGB data is packed as 8bpp, (msb)3R 2B 3G(lsb)
|
||||
*/
|
||||
#define RGB332_TO_BGR8(x) (((x << 3) & 0xC0) | ((x << 3) & 0x38) | ((x >> 5) & 7))
|
||||
|
||||
static av_always_inline void memcpy_rgb332_to_bgr8(uint8_t *dst, const uint8_t *src, int size)
|
||||
#define RBG323_TO_BGR8(x) (((x << 3) & 0xC0) | \
|
||||
((x << 3) & 0x38) | \
|
||||
((x >> 5) & 7))
|
||||
static av_always_inline
|
||||
void rbg323_to_bgr8(uint8_t *dst, const uint8_t *src, int size)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
dst[i] = RGB332_TO_BGR8(src[i]);
|
||||
dst[i] = RBG323_TO_BGR8(src[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,9 +67,12 @@ static av_always_inline void memcpy_rgb332_to_bgr8(uint8_t *dst, const uint8_t *
|
|||
* @param width Width of destination buffer (pixels)
|
||||
* @param height Height of destination buffer (pixels)
|
||||
* @param linesize Line size of destination buffer (bytes)
|
||||
*
|
||||
* @return <0 on error
|
||||
*/
|
||||
static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, const uint8_t *src, int src_size, int width, int height, int linesize)
|
||||
static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst,
|
||||
const uint8_t *src, int src_size,
|
||||
int width, int height, ptrdiff_t linesize)
|
||||
{
|
||||
const uint8_t *src_end = src + src_size;
|
||||
int x = 0, y = 0;
|
||||
|
@ -84,7 +93,7 @@ static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, const uint8_t *sr
|
|||
int length = FFMIN(v, width - x);
|
||||
if (length <= 0)
|
||||
break;
|
||||
memset(dst + y*linesize + x, RGB332_TO_BGR8(*src), length);
|
||||
memset(dst + y * linesize + x, RBG323_TO_BGR8(*src), length);
|
||||
INC_XY(length);
|
||||
v -= length;
|
||||
} while (v > 0);
|
||||
|
@ -95,7 +104,7 @@ static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, const uint8_t *sr
|
|||
int length = FFMIN3(v, width - x, src_end - src);
|
||||
if (src_end - src < length || length <= 0)
|
||||
break;
|
||||
memcpy_rgb332_to_bgr8(dst + y*linesize + x, src, length);
|
||||
rbg323_to_bgr8(dst + y * linesize + x, src, length);
|
||||
INC_XY(length);
|
||||
src += length;
|
||||
v -= length;
|
||||
|
@ -108,9 +117,8 @@ static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, const uint8_t *sr
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sgirle_decode_frame(AVCodecContext *avctx,
|
||||
void *data, int *got_frame,
|
||||
AVPacket *avpkt)
|
||||
static int sgirle_decode_frame(AVCodecContext *avctx, void *data,
|
||||
int *got_frame, AVPacket *avpkt)
|
||||
{
|
||||
SGIRLEContext *s = avctx->priv_data;
|
||||
int ret;
|
||||
|
@ -118,7 +126,8 @@ static int sgirle_decode_frame(AVCodecContext *avctx,
|
|||
if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = decode_sgirle8(avctx, s->frame->data[0], avpkt->data, avpkt->size, avctx->width, avctx->height, s->frame->linesize[0]);
|
||||
ret = decode_sgirle8(avctx, s->frame->data[0], avpkt->data, avpkt->size,
|
||||
avctx->width, avctx->height, s->frame->linesize[0]);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -140,7 +149,7 @@ static av_cold int sgirle_decode_end(AVCodecContext *avctx)
|
|||
|
||||
AVCodec ff_sgirle_decoder = {
|
||||
.name = "sgirle",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"),
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics RLE 8-bit video"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_SGIRLE,
|
||||
.priv_data_size = sizeof(SGIRLEContext),
|
||||
|
|
|
@ -2690,6 +2690,7 @@ static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id)
|
|||
case AV_CODEC_ID_WEBP_DEPRECATED : return AV_CODEC_ID_WEBP;
|
||||
case AV_CODEC_ID_HEVC_DEPRECATED : return AV_CODEC_ID_HEVC;
|
||||
case AV_CODEC_ID_SANM_DEPRECATED : return AV_CODEC_ID_SANM;
|
||||
case AV_CODEC_ID_SGIRLE_DEPRECATED : return AV_CODEC_ID_SGIRLE;
|
||||
case AV_CODEC_ID_VP7_DEPRECATED : return AV_CODEC_ID_VP7;
|
||||
default : return id;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#define LIBAVCODEC_VERSION_MAJOR 55
|
||||
#define LIBAVCODEC_VERSION_MINOR 58
|
||||
#define LIBAVCODEC_VERSION_MICRO 103
|
||||
#define LIBAVCODEC_VERSION_MICRO 104
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
LIBAVCODEC_VERSION_MINOR, \
|
||||
|
|
Loading…
Reference in New Issue