From 4de339e219908ff44cbb1d823edeeead3b8facda Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Apr 2011 15:31:39 +0200 Subject: introduce side information for AVPacket Signed-off-by: Luca Barbato --- libavcodec/avcodec.h | 37 +++++++++++++++++++++ libavcodec/avpacket.c | 91 ++++++++++++++++++++++++++++++++++++++++++++------- libavcodec/version.h | 4 +-- 3 files changed, 119 insertions(+), 13 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 109d2a4..df4e617 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1035,6 +1035,10 @@ typedef struct AVPanScan{ #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, +}; + typedef struct AVPacket { /** * Presentation timestamp in AVStream->time_base units; the time at which @@ -1057,6 +1061,17 @@ typedef struct AVPacket { int stream_index; int flags; /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + struct { + uint8_t *data; + int size; + enum AVPacketSideDataType type; + } *side_data; + int side_data_elems; + + /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ @@ -3202,6 +3217,28 @@ int av_dup_packet(AVPacket *pkt); */ void av_free_packet(AVPacket *pkt); +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + /* resample.c */ struct ReSampleContext; diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index f6aef20..4b1002f 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -26,12 +26,21 @@ void av_destruct_packet_nofree(AVPacket *pkt) { pkt->data = NULL; pkt->size = 0; + pkt->side_data = NULL; + pkt->side_data_elems = 0; } void av_destruct_packet(AVPacket *pkt) { + int i; + av_free(pkt->data); pkt->data = NULL; pkt->size = 0; + + for (i = 0; i < pkt->side_data_elems; i++) + av_free(pkt->side_data[i].data); + av_freep(&pkt->side_data); + pkt->side_data_elems = 0; } void av_init_packet(AVPacket *pkt) @@ -44,6 +53,8 @@ void av_init_packet(AVPacket *pkt) pkt->flags = 0; pkt->stream_index = 0; pkt->destruct= NULL; + pkt->side_data = NULL; + pkt->side_data_elems = 0; } int av_new_packet(AVPacket *pkt, int size) @@ -89,21 +100,38 @@ int av_grow_packet(AVPacket *pkt, int grow_by) return 0; } +#define DUP_DATA(dst, size, padding) \ + do { \ + void *data; \ + if (padding) { \ + if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \ + return AVERROR(ENOMEM); \ + data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \ + } else { \ + data = av_malloc(size); \ + } \ + if (!data) \ + return AVERROR(ENOMEM); \ + memcpy(data, dst, size); \ + if (padding) \ + memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \ + dst = data; \ + } while(0) + int av_dup_packet(AVPacket *pkt) { if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) { - uint8_t *data; - /* We duplicate the packet and don't forget to add the padding again. */ - if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE) - return AVERROR(ENOMEM); - data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!data) { - return AVERROR(ENOMEM); - } - memcpy(data, pkt->data, pkt->size); - memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - pkt->data = data; + DUP_DATA(pkt->data, pkt->size, 1); pkt->destruct = av_destruct_packet; + + if (pkt->side_data_elems) { + int i; + + DUP_DATA(pkt->side_data, pkt->side_data_elems * sizeof(*pkt->side_data), 0); + for (i = 0; i < pkt->side_data_elems; i++) { + DUP_DATA(pkt->side_data[i].data, pkt->side_data[i].size, 1); + } + } } return 0; } @@ -113,5 +141,46 @@ void av_free_packet(AVPacket *pkt) if (pkt) { if (pkt->destruct) pkt->destruct(pkt); pkt->data = NULL; pkt->size = 0; + pkt->side_data = NULL; + pkt->side_data_elems = 0; + } +} + +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size) +{ + int elems = pkt->side_data_elems; + + if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) + return NULL; + if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) + return NULL; + + pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); + if (!pkt->side_data) + return NULL; + + pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + if (!pkt->side_data[elems].data) + return NULL; + pkt->side_data[elems].size = size; + pkt->side_data[elems].type = type; + pkt->side_data_elems++; + + return pkt->side_data[elems].data; +} + +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size) +{ + int i; + + for (i = 0; i < pkt->side_data_elems; i++) { + if (pkt->side_data[i].type == type) { + if (size) + *size = pkt->side_data[i].size; + return pkt->side_data[i].data; + } } + return NULL; } diff --git a/libavcodec/version.h b/libavcodec/version.h index 0e2d766..4abdd5a 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,8 +21,8 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 52 -#define LIBAVCODEC_VERSION_MINOR 119 -#define LIBAVCODEC_VERSION_MICRO 1 +#define LIBAVCODEC_VERSION_MINOR 120 +#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ -- cgit v1.1 From 2d8591c27e2dc582a7020e2580e16278dbfbddff Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Apr 2011 15:49:51 +0200 Subject: make containers pass palette change in AVPacket Signed-off-by: Luca Barbato --- libavcodec/8bps.c | 21 +++++++++++---------- libavcodec/cinepak.c | 19 +++++++++++-------- libavcodec/idcinvideo.c | 12 ++++++------ libavcodec/interplayvideo.c | 21 ++++++++++----------- libavcodec/kmvc.c | 16 ++++++---------- libavcodec/msrle.c | 17 +++++++++-------- libavcodec/msvideo1.c | 24 +++++++++++++----------- libavcodec/qpeg.c | 12 +++++------- libavcodec/qtrle.c | 12 ++++++++---- libavcodec/rawdec.c | 10 +++++++--- libavcodec/smc.c | 13 ++++++++----- libavcodec/targa.c | 7 ------- libavcodec/tscc.c | 10 +++++++--- 13 files changed, 101 insertions(+), 93 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 1c6d406..055715f 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -50,6 +50,8 @@ typedef struct EightBpsContext { unsigned char planes; unsigned char planemap[4]; + + uint32_t pal[256]; } EightBpsContext; @@ -129,13 +131,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac } } - if (avctx->palctrl) { - memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); - if (avctx->palctrl->palette_changed) { + if (avctx->bits_per_coded_sample <= 8) { + const uint8_t *pal = av_packet_get_side_data(avpkt, + AV_PKT_DATA_PALETTE, + NULL); + if (pal) { c->pic.palette_has_changed = 1; - avctx->palctrl->palette_changed = 0; - } else - c->pic.palette_has_changed = 0; + memcpy(c->pal, pal, AVPALETTE_SIZE); + } + + memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE); } *data_size = sizeof(AVFrame); @@ -164,10 +169,6 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_PAL8; c->planes = 1; c->planemap[0] = 0; // 1st plane is palette indexes - if (avctx->palctrl == NULL) { - av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n"); - return -1; - } break; case 24: avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24); diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index f325bdb..4bda2a7 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -67,6 +67,7 @@ typedef struct CinepakContext { int sega_film_skip_bytes; + uint32_t pal[256]; } CinepakContext; static void cinepak_decode_codebook (cvid_codebook *codebook, @@ -395,7 +396,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx) s->sega_film_skip_bytes = -1; /* uninitialized state */ // check for paletted data - if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) { + if (avctx->bits_per_coded_sample != 8) { s->palette_video = 0; avctx->pix_fmt = PIX_FMT_YUV420P; } else { @@ -427,17 +428,19 @@ static int cinepak_decode_frame(AVCodecContext *avctx, return -1; } - cinepak_decode(s); - if (s->palette_video) { - memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); - if (avctx->palctrl->palette_changed) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + if (pal) { s->frame.palette_has_changed = 1; - avctx->palctrl->palette_changed = 0; - } else - s->frame.palette_has_changed = 0; + memcpy(s->pal, pal, AVPALETTE_SIZE); + } } + cinepak_decode(s); + + if (s->palette_video) + memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE); + *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index b8d47ad..ac56e19 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -72,6 +72,7 @@ typedef struct IdcinContext { hnode huff_nodes[256][HUF_TOKENS*2]; int num_huff_nodes[256]; + uint32_t pal[256]; } IdcinContext; /* @@ -213,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IdcinContext *s = avctx->priv_data; - AVPaletteControl *palette_control = avctx->palctrl; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); s->buf = buf; s->size = buf_size; @@ -228,13 +229,12 @@ static int idcin_decode_frame(AVCodecContext *avctx, idcin_decode_vlcs(s); - /* make the palette available on the way out */ - memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4); - /* If palette changed inform application*/ - if (palette_control->palette_changed) { - palette_control->palette_changed = 0; + if (pal) { s->frame.palette_has_changed = 1; + memcpy(s->pal, pal, AVPALETTE_SIZE); } + /* make the palette available on the way out */ + memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); *data_size = sizeof(AVFrame); *(AVFrame*)data = s->frame; diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 8dbe6f6..c12b241 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -77,6 +77,7 @@ typedef struct IpvideoContext { int stride; int upper_motion_limit_offset; + uint32_t pal[256]; } IpvideoContext; #define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \ @@ -969,7 +970,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s) if (!s->is_16bpp) { /* this is PAL8, so make the palette available */ - memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4); + memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE); s->stride = s->current_frame.linesize[0]; s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */ @@ -1023,10 +1024,6 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx) s->is_16bpp = avctx->bits_per_coded_sample == 16; avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8; - if (!s->is_16bpp && s->avctx->palctrl == NULL) { - av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n"); - return -1; - } dsputil_init(&s->dsp, avctx); @@ -1046,7 +1043,6 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IpvideoContext *s = avctx->priv_data; - AVPaletteControl *palette_control = avctx->palctrl; /* compressed buffer needs to be large enough to at least hold an entire * decoding map */ @@ -1063,13 +1059,16 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, return -1; } - ipvideo_decode_opcodes(s); - - if (!s->is_16bpp && palette_control->palette_changed) { - palette_control->palette_changed = 0; - s->current_frame.palette_has_changed = 1; + if (!s->is_16bpp) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + if (pal) { + s->current_frame.palette_has_changed = 1; + memcpy(s->pal, pal, AVPALETTE_SIZE); + } } + ipvideo_decode_opcodes(s); + *data_size = sizeof(AVFrame); *(AVFrame*)data = s->current_frame; diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index 2671cc6..c41c882 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -233,6 +233,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa int i; int header; int blocksize; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if (ctx->pic.data[0]) avctx->release_buffer(avctx, &ctx->pic); @@ -264,13 +265,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa ctx->pic.pict_type = FF_P_TYPE; } - /* if palette has been changed, copy it from palctrl */ - if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) { - memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE); - ctx->setpal = 1; - ctx->avctx->palctrl->palette_changed = 0; - } - if (header & KMVC_PALETTE) { ctx->pic.palette_has_changed = 1; // palette starts from index 1 and has 127 entries @@ -279,6 +273,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa } } + if (pal) { + ctx->pic.palette_has_changed = 1; + memcpy(ctx->pal, pal, AVPALETTE_SIZE); + } + if (ctx->setpal) { ctx->setpal = 0; ctx->pic.palette_has_changed = 1; @@ -374,9 +373,6 @@ static av_cold int decode_init(AVCodecContext * avctx) src += 4; } c->setpal = 1; - if (c->avctx->palctrl) { - c->avctx->palctrl->palette_changed = 0; - } } avctx->pix_fmt = PIX_FMT_PAL8; diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index a400589..f426b05 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -26,9 +26,6 @@ * http://www.pcisys.net/~melanson/codecs/ * * The MS RLE decoder outputs PAL8 colorspace data. - * - * Note that this decoder expects the palette colors from the end of the - * BITMAPINFO header passed through palctrl. */ #include @@ -46,6 +43,7 @@ typedef struct MsrleContext { const unsigned char *buf; int size; + uint32_t pal[256]; } MsrleContext; static av_cold int msrle_decode_init(AVCodecContext *avctx) @@ -91,13 +89,16 @@ static int msrle_decode_frame(AVCodecContext *avctx, return -1; } - if (s->avctx->palctrl) { - /* make the palette available */ - memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); - if (s->avctx->palctrl->palette_changed) { + if (avctx->bits_per_coded_sample <= 8) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + + if (pal) { s->frame.palette_has_changed = 1; - s->avctx->palctrl->palette_changed = 0; + memcpy(s->pal, pal, AVPALETTE_SIZE); } + + /* make the palette available */ + memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } /* FIXME how to correctly detect RLE ??? */ diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index e01ddf5..a89ec6a 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -25,9 +25,6 @@ * For more information about the MS Video-1 format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * This decoder outputs either PAL8 or RGB555 data, depending on the - * whether a RGB palette was passed through palctrl; - * if it's present, then the data is PAL8; RGB555 otherwise. */ #include @@ -55,6 +52,7 @@ typedef struct Msvideo1Context { int mode_8bit; /* if it's not 8-bit, it's 16-bit */ + uint32_t pal[256]; } Msvideo1Context; static av_cold int msvideo1_decode_init(AVCodecContext *avctx) @@ -64,7 +62,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx) s->avctx = avctx; /* figure out the colorspace based on the presence of a palette */ - if (s->avctx->palctrl) { + if (s->avctx->bits_per_coded_sample == 8) { s->mode_8bit = 1; avctx->pix_fmt = PIX_FMT_PAL8; } else { @@ -173,13 +171,8 @@ static void msvideo1_decode_8bit(Msvideo1Context *s) } /* make the palette available on the way out */ - if (s->avctx->pix_fmt == PIX_FMT_PAL8) { - memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); - if (s->avctx->palctrl->palette_changed) { - s->frame.palette_has_changed = 1; - s->avctx->palctrl->palette_changed = 0; - } - } + if (s->avctx->pix_fmt == PIX_FMT_PAL8) + memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } static void msvideo1_decode_16bit(Msvideo1Context *s) @@ -309,6 +302,15 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, return -1; } + if (s->mode_8bit) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + + if (pal) { + memcpy(s->pal, pal, AVPALETTE_SIZE); + s->frame.palette_has_changed = 1; + } + } + if (s->mode_8bit) msvideo1_decode_8bit(s); else diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index ccd634a..c96184f 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -30,6 +30,7 @@ typedef struct QpegContext{ AVCodecContext *avctx; AVFrame pic; uint8_t *refdata; + uint32_t pal[256]; } QpegContext; static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size, @@ -256,6 +257,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p= (AVFrame*)&a->pic; uint8_t* outdata; int delta; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); if(p->data[0]) avctx->release_buffer(avctx, p); @@ -274,11 +276,11 @@ static int decode_frame(AVCodecContext *avctx, } /* make the palette available on the way out */ - memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE); - if (a->avctx->palctrl->palette_changed) { + if (pal) { a->pic.palette_has_changed = 1; - a->avctx->palctrl->palette_changed = 0; + memcpy(a->pal, pal, AVPALETTE_SIZE); } + memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE); *data_size = sizeof(AVFrame); *(AVFrame*)data = a->pic; @@ -289,10 +291,6 @@ static int decode_frame(AVCodecContext *avctx, static av_cold int decode_init(AVCodecContext *avctx){ QpegContext * const a = avctx->priv_data; - if (!avctx->palctrl) { - av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n"); - return -1; - } a->avctx = avctx; avctx->pix_fmt= PIX_FMT_PAL8; a->refdata = av_malloc(avctx->width * avctx->height); diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index a8cc903..e14c306 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -46,6 +46,7 @@ typedef struct QtrleContext { const unsigned char *buf; int size; + uint32_t pal[256]; } QtrleContext; #define CHECK_STREAM_PTR(n) \ @@ -511,12 +512,15 @@ static int qtrle_decode_frame(AVCodecContext *avctx, } if(has_palette) { - /* make the palette available on the way out */ - memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); - if (s->avctx->palctrl->palette_changed) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + + if (pal) { s->frame.palette_has_changed = 1; - s->avctx->palctrl->palette_changed = 0; + memcpy(s->pal, pal, AVPALETTE_SIZE); } + + /* make the palette available on the way out */ + memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); } done: diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c index 3c38829..3dbfdfe 100644 --- a/libavcodec/rawdec.c +++ b/libavcodec/rawdec.c @@ -158,9 +158,13 @@ static int raw_decode(AVCodecContext *avctx, (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){ frame->data[1]= context->palette; } - if (avctx->palctrl && avctx->palctrl->palette_changed) { - memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); - avctx->palctrl->palette_changed = 0; + if (avctx->pix_fmt == PIX_FMT_PAL8) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + + if (pal) { + memcpy(frame->data[1], pal, AVPALETTE_SIZE); + frame->palette_has_changed = 1; + } } if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0]+3)&~3; diff --git a/libavcodec/smc.c b/libavcodec/smc.c index fe92b43..e75203d 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -54,6 +54,7 @@ typedef struct SmcContext { unsigned char color_quads[COLORS_PER_TABLE * CQUAD]; unsigned char color_octets[COLORS_PER_TABLE * COCTET]; + uint32_t pal[256]; } SmcContext; #define GET_BLOCK_COUNT() \ @@ -110,11 +111,7 @@ static void smc_decode_stream(SmcContext *s) int color_octet_index = 0; /* make the palette available */ - memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); - if (s->avctx->palctrl->palette_changed) { - s->frame.palette_has_changed = 1; - s->avctx->palctrl->palette_changed = 0; - } + memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; stream_ptr += 4; @@ -440,6 +437,7 @@ static int smc_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmcContext *s = avctx->priv_data; + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); s->buf = buf; s->size = buf_size; @@ -452,6 +450,11 @@ static int smc_decode_frame(AVCodecContext *avctx, return -1; } + if (pal) { + s->frame.palette_has_changed = 1; + memcpy(s->pal, pal, AVPALETTE_SIZE); + } + smc_decode_stream(s); *data_size = sizeof(AVFrame); diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 06f87e4..910cc1b 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -171,13 +171,6 @@ static int decode_frame(AVCodecContext *avctx, stride = -p->linesize[0]; } - if(avctx->pix_fmt == PIX_FMT_PAL8 && avctx->palctrl){ - memcpy(p->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); - if(avctx->palctrl->palette_changed){ - p->palette_has_changed = 1; - avctx->palctrl->palette_changed = 0; - } - } if(colors){ size_t pal_size; if((colors + first_clr) > 256){ diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index f695973..bd05f02 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -60,6 +60,8 @@ typedef struct TsccContext { unsigned char* decomp_buf; int height; z_stream zstream; + + uint32_t pal[256]; } CamtasiaContext; /* @@ -111,11 +113,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac /* make the palette available on the way out */ if (c->avctx->pix_fmt == PIX_FMT_PAL8) { - memcpy(c->pic.data[1], c->avctx->palctrl->palette, AVPALETTE_SIZE); - if (c->avctx->palctrl->palette_changed) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + + if (pal) { c->pic.palette_has_changed = 1; - c->avctx->palctrl->palette_changed = 0; + memcpy(c->pal, pal, AVPALETTE_SIZE); } + memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); } *data_size = sizeof(AVFrame); -- cgit v1.1 From c0eee89337be5f5728e7da84aa15c658e07506ca Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 13 Apr 2011 17:36:02 +0200 Subject: make av_dup_packet() more cautious on allocation failures Signed-off-by: Luca Barbato --- libavcodec/avpacket.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 4b1002f..e0e4df4 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -100,19 +100,19 @@ int av_grow_packet(AVPacket *pkt, int grow_by) return 0; } -#define DUP_DATA(dst, size, padding) \ +#define DUP_DATA(dst, src, size, padding) \ do { \ void *data; \ if (padding) { \ if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \ - return AVERROR(ENOMEM); \ + goto failed_alloc; \ data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \ } else { \ data = av_malloc(size); \ } \ if (!data) \ - return AVERROR(ENOMEM); \ - memcpy(data, dst, size); \ + goto failed_alloc; \ + memcpy(data, src, size); \ if (padding) \ memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \ dst = data; \ @@ -120,20 +120,32 @@ int av_grow_packet(AVPacket *pkt, int grow_by) int av_dup_packet(AVPacket *pkt) { + AVPacket tmp_pkt; + if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) { - DUP_DATA(pkt->data, pkt->size, 1); + tmp_pkt = *pkt; + + pkt->data = NULL; + pkt->side_data = NULL; + DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1); pkt->destruct = av_destruct_packet; if (pkt->side_data_elems) { int i; - DUP_DATA(pkt->side_data, pkt->side_data_elems * sizeof(*pkt->side_data), 0); + DUP_DATA(pkt->side_data, tmp_pkt.side_data, + pkt->side_data_elems * sizeof(*pkt->side_data), 0); + memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data)); for (i = 0; i < pkt->side_data_elems; i++) { - DUP_DATA(pkt->side_data[i].data, pkt->side_data[i].size, 1); + DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data, + pkt->side_data[i].size, 1); } } } return 0; +failed_alloc: + av_destruct_packet(pkt); + return AVERROR(ENOMEM); } void av_free_packet(AVPacket *pkt) -- cgit v1.1 From 58bb6b7d9327eeed4d450e23c1316c439b6204a9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 16 Apr 2011 15:07:14 -0400 Subject: wmv3dec: fix playback of complex WMV3 files using simple_idct. IDCT coefficients are read transposed, but simple_idct does not expect this. Therefore, only do tranposed coefficient reading if we're not using simple_idct. Fixes http://forum.videolan.org/viewtopic.php?f=14&t=89651 --- libavcodec/vc1.h | 1 + libavcodec/vc1dec.c | 91 +++++++++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 41 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index d0c0ccc..db8a7f4 100644 --- a/libavcodec/vc1.h +++ b/libavcodec/vc1.h @@ -218,6 +218,7 @@ typedef struct VC1Context{ int range_x, range_y; ///< MV range uint8_t pq, altpq; ///< Current/alternate frame quantizer scale uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT + int left_blk_sh, top_blk_sh; ///< Either 3 or 0, positions of l/t in blk[] const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode /** pquant parameters */ diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 8200cde..94fbffb 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -1499,16 +1499,16 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k] += ac_val[k]; + block[k << v->left_blk_sh] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k + 8]; + block[k << v->top_blk_sh] += ac_val[k + 8]; } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k]; - ac_val2[k + 8] = block[k << 3]; + ac_val2[k] = block[k << v->left_blk_sh]; + ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ @@ -1545,15 +1545,15 @@ not_coded: if(s->ac_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k] = ac_val[k] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -v->pq : v->pq; + block[k << v->left_blk_sh] = ac_val[k] * scale; + if(!v->pquantizer && block[k << v->left_blk_sh]) + block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -v->pq : v->pq; } } else { //top for(k = 1; k < 8; k++) { - block[k << 3] = ac_val[k + 8] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; + block[k << v->top_blk_sh] = ac_val[k + 8] * scale; + if(!v->pquantizer && block[k << v->top_blk_sh]) + block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -v->pq : v->pq; } } i = 63; @@ -1680,25 +1680,25 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k] += ac_val[k]; + block[k << v->left_blk_sh] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k + 8]; + block[k << v->top_blk_sh] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k]; - ac_val2[k + 8] = block[k << 3]; + ac_val2[k ] = block[k << v->left_blk_sh]; + ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ @@ -1740,15 +1740,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k] = ac_val2[k] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << v->left_blk_sh] = ac_val2[k] * scale; + if(!v->pquantizer && block[k << v->left_blk_sh]) + block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << v->top_blk_sh]) + block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } i = 63; @@ -1878,25 +1878,25 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { //top for(k = 1; k < 8; k++) - block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; + block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) - block[k] += ac_val[k]; + block[k << v->left_blk_sh] += ac_val[k]; } else { //top for(k = 1; k < 8; k++) - block[k << 3] += ac_val[k + 8]; + block[k << v->top_blk_sh] += ac_val[k + 8]; } } } /* save AC coeffs for further prediction */ for(k = 1; k < 8; k++) { - ac_val2[k] = block[k]; - ac_val2[k + 8] = block[k << 3]; + ac_val2[k ] = block[k << v->left_blk_sh]; + ac_val2[k + 8] = block[k << v->top_blk_sh]; } /* scale AC coeffs */ @@ -1938,15 +1938,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c if(use_pred) { if(dc_pred_dir) { //left for(k = 1; k < 8; k++) { - block[k] = ac_val2[k] * scale; - if(!v->pquantizer && block[k]) - block[k] += (block[k] < 0) ? -mquant : mquant; + block[k << v->left_blk_sh] = ac_val2[k] * scale; + if(!v->pquantizer && block[k << v->left_blk_sh]) + block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; } } else { //top for(k = 1; k < 8; k++) { - block[k << 3] = ac_val2[k + 8] * scale; - if(!v->pquantizer && block[k << 3]) - block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; + block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; + if(!v->pquantizer && block[k << v->top_blk_sh]) + block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; } } i = 63; @@ -3236,13 +3236,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) return -1; if (vc1_init_common(v) < 0) return -1; ff_vc1dsp_init(&v->vc1dsp); - for (i = 0; i < 64; i++) { -#define transpose(x) ((x>>3) | ((x&7)<<3)) - v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); - v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); - v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); - v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); - } avctx->coded_width = avctx->width; avctx->coded_height = avctx->height; @@ -3326,6 +3319,22 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) s->mb_width = (avctx->coded_width+15)>>4; s->mb_height = (avctx->coded_height+15)>>4; + if (v->res_fasttx) { + for (i = 0; i < 64; i++) { +#define transpose(x) ((x>>3) | ((x&7)<<3)) + v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); + v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); + v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); + v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); + } + v->left_blk_sh = 0; + v->top_blk_sh = 3; + } else { + memcpy(v->zz_8x8, wmv1_scantable, 4*64); + v->left_blk_sh = 3; + v->top_blk_sh = 0; + } + /* Allocate mb bitplanes */ v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height); v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height); -- cgit v1.1 From 0b05864eef3d5323ee02515e3b62693230f7e4fb Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 16 Apr 2011 19:29:05 +0000 Subject: vc1: fix fate-vc1 after previous commit. PROFILE_ADVANCED doesn't set res_fasttx, so make that a special case in the condition that decides which IDCT to use (and whether to read coefficients transposed or not). Signed-off-by: Kostya Shishkov --- libavcodec/vc1dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavcodec') diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 94fbffb..6e73317 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -3319,7 +3319,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) s->mb_width = (avctx->coded_width+15)>>4; s->mb_height = (avctx->coded_height+15)>>4; - if (v->res_fasttx) { + if (v->profile == PROFILE_ADVANCED || v->res_fasttx) { for (i = 0; i < 64; i++) { #define transpose(x) ((x>>3) | ((x&7)<<3)) v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); -- cgit v1.1 From 4c64c8e95a02b1d69aabb400fa73cba7ef8f41f7 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 17 Apr 2011 12:26:47 -0400 Subject: ac3dec: fix processing of delta bit allocation information. The number of dba segments is the coded value + 1. The coupling dba offset starts at the first coupling band, not at zero. --- libavcodec/ac3.c | 4 ++-- libavcodec/ac3dec.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 704c6e0..99e5b50 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -192,9 +192,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { int i, seg, delta; - if (dba_nsegs >= 8) + if (dba_nsegs > 8) return -1; - band = 0; + band = band_start; for (seg = 0; seg < dba_nsegs; seg++) { band += dba_offsets[seg]; if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band) diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 396df87..015ebae 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1173,8 +1173,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) /* channel delta offset, len and bit allocation */ for (ch = !cpl_in_use; ch <= fbw_channels; ch++) { if (s->dba_mode[ch] == DBA_NEW) { - s->dba_nsegs[ch] = get_bits(gbc, 3); - for (seg = 0; seg <= s->dba_nsegs[ch]; seg++) { + s->dba_nsegs[ch] = get_bits(gbc, 3) + 1; + for (seg = 0; seg < s->dba_nsegs[ch]; seg++) { s->dba_offsets[ch][seg] = get_bits(gbc, 5); s->dba_lengths[ch][seg] = get_bits(gbc, 4); s->dba_values[ch][seg] = get_bits(gbc, 3); -- cgit v1.1 From 6001dad6e2eb654fba9bf3d6bda6a3734253cbc6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 15 Apr 2011 22:30:26 +0200 Subject: Replace more FFmpeg references by Libav. --- libavcodec/dsputil.c | 2 +- libavcodec/dv.c | 4 ++-- libavcodec/dxva2.h | 2 +- libavcodec/dxva2_h264.c | 8 ++++---- libavcodec/jpeglsdec.c | 2 +- libavcodec/libdirac.h | 2 +- libavcodec/libdiracdec.c | 4 ++-- libavcodec/libschroedingerdec.c | 4 ++-- libavcodec/libtheoraenc.c | 2 +- libavcodec/mimic.c | 2 +- libavcodec/truemotion2.c | 2 +- libavcodec/utils.c | 2 +- libavcodec/vaapi_h264.c | 2 +- libavcodec/vaapi_mpeg4.c | 2 +- libavcodec/vaapi_vc1.c | 4 ++-- libavcodec/version.h | 8 ++++---- libavcodec/vorbis_enc.c | 2 +- libavcodec/wmavoice.c | 2 +- 18 files changed, 28 insertions(+), 28 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index ddaf020..215c1e4 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -4061,7 +4061,7 @@ int ff_check_alignment(void){ "Compiler did not align stack variables. Libavcodec has been miscompiled\n" "and may be very slow or crash. This is not a bug in libavcodec,\n" "but in the compiler. You may try recompiling using gcc >= 4.2.\n" - "Do not report crashes to FFmpeg developers.\n"); + "Do not report crashes to Libav developers.\n"); #endif did_fail=1; } diff --git a/libavcodec/dv.c b/libavcodec/dv.c index e4f06a7..0b87d28 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -787,7 +787,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i method suggested in SMPTE 314M Table 22, and an improved method. The SMPTE method is very conservative; it assigns class 3 (i.e. severe quantization) to any block where the largest AC - component is greater than 36. FFmpeg's DV encoder tracks AC bit + component is greater than 36. Libav's DV encoder tracks AC bit consumption precisely, so there is no need to bias most blocks towards strongly lossy compression. Instead, we assign class 2 to most blocks, and use class 3 only when strictly necessary @@ -795,7 +795,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i #if 0 /* SMPTE spec method */ static const int classes[] = {12, 24, 36, 0xffff}; -#else /* improved FFmpeg method */ +#else /* improved Libav method */ static const int classes[] = {-1, -1, 255, 0xffff}; #endif int max = classes[0]; diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h index 6f08a84..5db5d0b 100644 --- a/libavcodec/dxva2.h +++ b/libavcodec/dxva2.h @@ -60,7 +60,7 @@ struct dxva_context { uint64_t workaround; /** - * Private to the FFmpeg AVHWAccel implementation + * Private to the Libav AVHWAccel implementation */ unsigned report_id; }; diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index f9dc720..d99bb0a 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -95,7 +95,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context pp->wBitFields = ((s->picture_structure != PICT_FRAME) << 0) | (h->sps.mb_aff << 1) | (h->sps.residual_color_transform_flag << 2) | - /* sp_for_switch_flag (not implemented by FFmpeg) */ + /* sp_for_switch_flag (not implemented by Libav) */ (0 << 3) | (h->sps.chroma_format_idc << 4) | ((h->nal_ref_idc != 0) << 6) | @@ -146,8 +146,8 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context pp->deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; pp->redundant_pic_cnt_present_flag= h->pps.redundant_pic_cnt_present; pp->Reserved8BitsB = 0; - pp->slice_group_change_rate_minus1= 0; /* XXX not implemented by FFmpeg */ - //pp->SliceGroupMap[810]; /* XXX not implemented by FFmpeg */ + pp->slice_group_change_rate_minus1= 0; /* XXX not implemented by Libav */ + //pp->SliceGroupMap[810]; /* XXX not implemented by Libav */ } static void fill_scaling_lists(const H264Context *h, DXVA_Qmatrix_H264 *qm) @@ -243,7 +243,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, } } } - slice->slice_qs_delta = 0; /* XXX not implemented by FFmpeg */ + slice->slice_qs_delta = 0; /* XXX not implemented by Libav */ slice->slice_qp_delta = s->qscale - h->pps.init_qp; slice->redundant_pic_cnt = h->redundant_pic_count; if (h->slice_type == FF_B_TYPE) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index adaa0a3..69cc1d3 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -40,7 +40,7 @@ * (or test broken JPEG-LS decoder) and slow down ordinary decoding a bit. * * There is no Golomb code with length >= 32 bits possible, so check and -* avoid situation of 32 zeros, FFmpeg Golomb decoder is painfully slow +* avoid situation of 32 zeros, Libav Golomb decoder is painfully slow * on this errors. */ //#define JLS_BROKEN diff --git a/libavcodec/libdirac.h b/libavcodec/libdirac.h index 9430dcc..7f79122 100644 --- a/libavcodec/libdirac.h +++ b/libavcodec/libdirac.h @@ -30,7 +30,7 @@ #include /** -* Table providing a Dirac chroma format to FFmpeg pixel format mapping. +* Table providing a Dirac chroma format to Libav pixel format mapping. */ static const struct { enum PixelFormat ff_pix_fmt; diff --git a/libavcodec/libdiracdec.c b/libavcodec/libdiracdec.c index 3670e57..08fec3d 100644 --- a/libavcodec/libdiracdec.c +++ b/libavcodec/libdiracdec.c @@ -47,7 +47,7 @@ typedef struct FfmpegDiracDecoderParams { /** -* returns FFmpeg chroma format +* returns Libav chroma format */ static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt) { @@ -103,7 +103,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext, case STATE_SEQUENCE: { - /* tell FFmpeg about sequence details */ + /* tell Libav about sequence details */ dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params; if (av_image_check_size(src_params->width, src_params->height, diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index 672745a..ee29704 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -118,7 +118,7 @@ static SchroBuffer* FfmpegFindNextSchroParseUnit(FfmpegSchroParseUnitContext *pa } /** -* Returns FFmpeg chroma format. +* Returns Libav chroma format. */ static enum PixelFormat GetFfmpegChromaFormat(SchroChromaFormat schro_pix_fmt) { @@ -169,7 +169,7 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext) p_schro_params->format = schro_decoder_get_video_format(decoder); - /* Tell FFmpeg about sequence details. */ + /* Tell Libav about sequence details. */ if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height, 0, avccontext) < 0) { av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n", diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index cc614e3..86cc09f 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -30,7 +30,7 @@ * and o_ prefixes on variables which are libogg types. */ -/* FFmpeg includes */ +/* Libav includes */ #include "libavutil/intreadwrite.h" #include "libavutil/log.h" #include "libavutil/base64.h" diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 133d26f..0f3ae59 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -209,7 +209,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale) value = get_bits(&ctx->gb, num_bits); - /* FFmpeg's IDCT behaves somewhat different from the original code, so + /* Libav's IDCT behaves somewhat different from the original code, so * a factor of 4 was added to the input */ coeff = vlcdec_lookup[num_bits][value]; diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 958ed5a..6c3ed8c 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -64,7 +64,7 @@ typedef struct TM2Context{ * Huffman codes for each of streams */ typedef struct TM2Codes{ - VLC vlc; ///< table for FFmpeg bitstream reader + VLC vlc; ///< table for Libav bitstream reader int bits; int *recode; ///< table for converting from code indexes to values int length; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 427e9e4..8575388 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1189,7 +1189,7 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){ void av_log_missing_feature(void *avc, const char *feature, int want_sample) { - av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg " + av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your Libav " "version to the newest one from Git. If the problem still " "occurs, it means that your file has a feature which has not " "been implemented.", feature); diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index 805e4ef..3d57a21 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -258,7 +258,7 @@ static int start_frame(AVCodecContext *avctx, pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; - pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in FFmpeg */ + pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in Libav */ pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; diff --git a/libavcodec/vaapi_mpeg4.c b/libavcodec/vaapi_mpeg4.c index 85e2a50..1b3817a 100644 --- a/libavcodec/vaapi_mpeg4.c +++ b/libavcodec/vaapi_mpeg4.c @@ -129,7 +129,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer /* video_plane_with_short_video_header() contains all GOBs * in-order, and this is what VA API (Intel backend) expects: only - * a single slice param. So fake macroblock_number for FFmpeg so + * a single slice param. So fake macroblock_number for Libav so * that we don't call vaapi_mpeg4_decode_slice() again */ if (avctx->codec->id == CODEC_ID_H263) diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index 5bce829..8effa7e 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -24,7 +24,7 @@ #include "vc1.h" #include "vc1data.h" -/** Translate FFmpeg MV modes to VA API */ +/** Translate Libav MV modes to VA API */ static int get_VAMvModeVC1(enum MVModes mv_mode) { switch (mv_mode) { @@ -116,7 +116,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v) return 0; } -/** Pack FFmpeg bitplanes into a VABitPlaneBuffer element */ +/** Pack Libav bitplanes into a VABitPlaneBuffer element */ static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride) { const int bitplane_index = n / 2; diff --git a/libavcodec/version.h b/libavcodec/version.h index 4abdd5a..1a470a1 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -1,19 +1,19 @@ /* * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * Libav is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * FFmpeg is distributed in the hope that it will be useful, + * Libav is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index 748fbd6..74933af 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -957,7 +957,7 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext) vorbis_enc_context *venc = avccontext->priv_data; if (avccontext->channels != 2) { - av_log(avccontext, AV_LOG_ERROR, "Current FFmpeg Vorbis encoder only supports 2 channels.\n"); + av_log(avccontext, AV_LOG_ERROR, "Current Libav Vorbis encoder only supports 2 channels.\n"); return -1; } diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index ea8260c..33c34a0 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1912,7 +1912,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data, *data_size = 0; /* Packets are sometimes a multiple of ctx->block_align, with a packet - * header at each ctx->block_align bytes. However, FFmpeg's ASF demuxer + * header at each ctx->block_align bytes. However, Libav's ASF demuxer * feeds us ASF packets, which may concatenate multiple "codec" packets * in a single "muxer" packet, so we artificially emulate that by * capping the packet size at ctx->block_align. */ -- cgit v1.1