From 4de339e219908ff44cbb1d823edeeead3b8facda Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Apr 2011 15:31:39 +0200 Subject: [PATCH 1/9] 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(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 109d2a4923..df4e61798e 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 @@ -1056,6 +1060,17 @@ typedef struct AVPacket { int size; 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 f6aef20423..4b1002f62b 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 0e2d766bfe..4abdd5a070 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, \ From 2d8591c27e2dc582a7020e2580e16278dbfbddff Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 9 Apr 2011 15:49:51 +0200 Subject: [PATCH 2/9] make containers pass palette change in AVPacket Signed-off-by: Luca Barbato --- libavcodec/8bps.c | 21 +++++++++++---------- libavcodec/cinepak.c | 21 ++++++++++++--------- 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 +++++++--- libavformat/asf.h | 2 ++ libavformat/asfdec.c | 21 +++++++++++++++------ libavformat/avidec.c | 24 +++++++++++------------- libavformat/idcin.c | 17 +++++++++++------ libavformat/ipmovie.c | 23 +++++++++++++++-------- libavformat/isom.h | 2 ++ libavformat/mov.c | 20 +++++++++++++++----- 20 files changed, 173 insertions(+), 132 deletions(-) diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 1c6d4068b0..055715fde5 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 f325bdb0ce..4bda2a74eb 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,16 +428,18 @@ static int cinepak_decode_frame(AVCodecContext *avctx, return -1; } + if (s->palette_video) { + const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); + if (pal) { + s->frame.palette_has_changed = 1; + memcpy(s->pal, pal, AVPALETTE_SIZE); + } + } + cinepak_decode(s); - if (s->palette_video) { - memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); - if (avctx->palctrl->palette_changed) { - s->frame.palette_has_changed = 1; - avctx->palctrl->palette_changed = 0; - } else - s->frame.palette_has_changed = 0; - } + 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 b8d47ad555..ac56e19442 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 8dbe6f6cbe..c12b241fcb 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 2671cc6b24..c41c8820c2 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 a400589fde..f426b058bd 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 e01ddf5c47..a89ec6ac65 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 ccd634ae80..c96184ff38 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 a8cc903fcb..e14c306c6b 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 3c38829f17..3dbfdfe793 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 fe92b43bc6..e75203d7a5 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 06f87e44b2..910cc1ba94 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 f69597369a..bd05f02a61 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); diff --git a/libavformat/asf.h b/libavformat/asf.h index b56345993d..b72445def9 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -44,6 +44,8 @@ typedef struct { uint16_t stream_language_index; + int palette_changed; + uint32_t palette[256]; } ASFStream; typedef uint8_t ff_asf_guid[16]; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 30828ad6ff..36e9efad75 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -365,15 +365,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) /* This is true for all paletted codecs implemented in ffmpeg */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { int av_unused i; - st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); + asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); #else - memcpy(st->codec->palctrl->palette, st->codec->extradata, - FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); + memcpy(asf_st->palette, st->codec->extradata, + FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif - st->codec->palctrl->palette_changed = 1; + asf_st->palette_changed = 1; } st->codec->codec_tag = tag1; @@ -966,6 +965,17 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk asf_st->pkt.stream_index = asf->stream_index; asf_st->pkt.pos = asf_st->packet_pos= asf->packet_pos; + if (asf_st->pkt.data && asf_st->palette_changed) { + uint8_t *pal; + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + if (!pal) { + av_log(s, AV_LOG_ERROR, "Cannot append palette to packet\n"); + } else { + memcpy(pal, asf_st->palette, AVPALETTE_SIZE); + asf_st->palette_changed = 0; + } + } //printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", //asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY, //s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size); @@ -1127,7 +1137,6 @@ static int asf_read_close(AVFormatContext *s) asf_reset_header(s); for(i=0;inb_streams;i++) { AVStream *st = s->streams[i]; - av_free(st->codec->palctrl); } return 0; } diff --git a/libavformat/avidec.c b/libavformat/avidec.c index ec3aa9335a..c7bbf422b7 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -590,15 +590,14 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* This code assumes that extradata contains only palette. */ /* This is true for all paletted codecs implemented in FFmpeg. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { - st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) - st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); + ast->pal[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); #else - memcpy(st->codec->palctrl->palette, st->codec->extradata, + memcpy(ast->pal, st->codec->extradata, FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif - st->codec->palctrl->palette_changed = 1; + ast->has_pal = 1; } print_tag("video", tag1, 0); @@ -932,14 +931,14 @@ resync: return err; if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){ - void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE); - if(ptr){ - ast->has_pal=0; - pkt->size += 4*256; - pkt->data= ptr; - memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256); - }else - av_log(s, AV_LOG_ERROR, "Failed to append palette\n"); + uint8_t *pal; + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + if(!pal){ + av_log(s, AV_LOG_ERROR, "Failed to allocate data for palette\n"); + }else{ + memcpy(pal, ast->pal, AVPALETTE_SIZE); + ast->has_pal = 0; + } } if (CONFIG_DV_DEMUXER && avi->dv_demux) { @@ -1340,7 +1339,6 @@ static int avi_read_close(AVFormatContext *s) for(i=0;inb_streams;i++) { AVStream *st = s->streams[i]; AVIStream *ast = st->priv_data; - av_free(st->codec->palctrl); if (ast) { if (ast->sub_ctx) { av_freep(&ast->sub_ctx->pb); diff --git a/libavformat/idcin.c b/libavformat/idcin.c index e6883c7d94..04ae687c6c 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -86,8 +86,6 @@ typedef struct IdcinDemuxContext { int audio_present; int64_t pts; - - AVPaletteControl palctrl; } IdcinDemuxContext; static int idcin_probe(AVProbeData *p) @@ -172,8 +170,6 @@ static int idcin_read_header(AVFormatContext *s, if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return AVERROR(EIO); - /* save a reference in order to transport the palette */ - st->codec->palctrl = &idcin->palctrl; /* if sample rate is 0, assume no audio */ if (sample_rate) { @@ -226,6 +222,7 @@ static int idcin_read_packet(AVFormatContext *s, int palette_scale; unsigned char r, g, b; unsigned char palette_buffer[768]; + uint32_t palette[256]; if (s->pb->eof_reached) return AVERROR(EIO); @@ -236,7 +233,6 @@ static int idcin_read_packet(AVFormatContext *s, return AVERROR(EIO); } else if (command == 1) { /* trigger a palette change */ - idcin->palctrl.palette_changed = 1; if (avio_read(pb, palette_buffer, 768) != 768) return AVERROR(EIO); /* scale the palette as necessary */ @@ -251,7 +247,7 @@ static int idcin_read_packet(AVFormatContext *s, r = palette_buffer[i * 3 ] << palette_scale; g = palette_buffer[i * 3 + 1] << palette_scale; b = palette_buffer[i * 3 + 2] << palette_scale; - idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b); + palette[i] = (r << 16) | (g << 8) | (b); } } @@ -262,6 +258,15 @@ static int idcin_read_packet(AVFormatContext *s, ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) return ret; + if (command == 1) { + uint8_t *pal; + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + if (ret < 0) + return ret; + memcpy(pal, palette, AVPALETTE_SIZE); + } pkt->stream_index = idcin->video_stream_index; pkt->pts = idcin->pts; } else { diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index e1d08df1f3..e3215d3b79 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -97,6 +97,8 @@ typedef struct IPMVEContext { unsigned int video_width; unsigned int video_height; int64_t video_pts; + uint32_t palette[256]; + int has_palette; unsigned int audio_bits; unsigned int audio_channels; @@ -116,8 +118,6 @@ typedef struct IPMVEContext { int64_t next_chunk_offset; - AVPaletteControl palette_control; - } IPMVEContext; static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, @@ -162,6 +162,17 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size)) return CHUNK_NOMEM; + if (s->has_palette) { + uint8_t *pal; + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, + AVPALETTE_SIZE); + if (pal) { + memcpy(pal, s->palette, AVPALETTE_SIZE); + s->has_palette = 0; + } + } + pkt->pos= s->decode_map_chunk_offset; avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; @@ -456,10 +467,9 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, r = scratch[j++] * 4; g = scratch[j++] * 4; b = scratch[j++] * 4; - s->palette_control.palette[i] = (r << 16) | (g << 8) | (b); + s->palette[i] = (r << 16) | (g << 8) | (b); } - /* indicate a palette change */ - s->palette_control.palette_changed = 1; + s->has_palette = 1; break; case OPCODE_SET_PALETTE_COMPRESSED: @@ -573,9 +583,6 @@ static int ipmovie_read_header(AVFormatContext *s, st->codec->height = ipmovie->video_height; st->codec->bits_per_coded_sample = ipmovie->video_bpp; - /* palette considerations */ - st->codec->palctrl = &ipmovie->palette_control; - if (ipmovie->audio_type) { st = av_new_stream(s, 0); if (!st) diff --git a/libavformat/isom.h b/libavformat/isom.h index fba49635d6..48e0bcf9e2 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -123,6 +123,8 @@ typedef struct MOVStreamContext { int width; ///< tkhd width int height; ///< tkhd height int dts_shift; ///< dts shift when ctts is negative + uint32_t palette[256]; + int has_palette; } MOVStreamContext; typedef struct MOVContext { diff --git a/libavformat/mov.c b/libavformat/mov.c index 61ceaac351..bd8cf031e0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1027,7 +1027,6 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) unsigned int color_start, color_count, color_end; unsigned char r, g, b; - st->codec->palctrl = av_malloc(sizeof(*st->codec->palctrl)); if (color_greyscale) { int color_index, color_dec; /* compute the greyscale palette */ @@ -1037,7 +1036,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) color_dec = 256 / (color_count - 1); for (j = 0; j < color_count; j++) { r = g = b = color_index; - st->codec->palctrl->palette[j] = + sc->palette[j] = (r << 16) | (g << 8) | (b); color_index -= color_dec; if (color_index < 0) @@ -1058,7 +1057,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) r = color_table[j * 3 + 0]; g = color_table[j * 3 + 1]; b = color_table[j * 3 + 2]; - st->codec->palctrl->palette[j] = + sc->palette[j] = (r << 16) | (g << 8) | (b); } } else { @@ -1080,12 +1079,12 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) avio_r8(pb); b = avio_r8(pb); avio_r8(pb); - st->codec->palctrl->palette[j] = + sc->palette[j] = (r << 16) | (g << 8) | (b); } } } - st->codec->palctrl->palette_changed = 1; + sc->has_palette = 1; } } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { int bits_per_sample, flags; @@ -2433,6 +2432,17 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(sc->pb, pkt, sample->size); if (ret < 0) return ret; + if (sc->has_palette) { + uint8_t *pal; + + pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + if (!pal) { + av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n"); + } else { + memcpy(pal, sc->palette, AVPALETTE_SIZE); + sc->has_palette = 0; + } + } #if CONFIG_DV_DEMUXER if (mov->dv_demux && sc->dv_audio_container) { dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size); From c0eee89337be5f5728e7da84aa15c658e07506ca Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Wed, 13 Apr 2011 17:36:02 +0200 Subject: [PATCH 3/9] 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(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 4b1002f62b..e0e4df46f2 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) From 14622ef05d36693aad4a92bb6313bb9d2a03c8dc Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 15 Apr 2011 17:49:36 +0200 Subject: [PATCH 4/9] Replace references to ffmpeg-devel with libav-devel; fix roundup URL. --- doc/issue_tracker.txt | 4 ++-- tools/patcheck | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt index d92ab4221b..5a15a9b665 100644 --- a/doc/issue_tracker.txt +++ b/doc/issue_tracker.txt @@ -15,7 +15,7 @@ be properly added to the respective issue. The subscription URL for the ffmpeg-issues list is: http://live.polito/mailman/listinfo/ffmpeg-issues The URL of the webinterface of the tracker is: -http(s)://roundup.ffmpeg/roundup/ffmpeg/ +http(s)://roundup.libav.org/ Note the URLs in this document are obfuscated, you must append the top level domain for non-profit organizations to the tracker, and of Italy to the mailing list. @@ -187,7 +187,7 @@ feature_request/closed/wont_implement be legal, philosophical or others. Note, please do not use type-status-substatus combinations other than the -above without asking on ffmpeg-dev first! +above without asking on libav-devel first! Note2, if you provide the requested info do not forget to remove the needs_more_info substate. diff --git a/tools/patcheck b/tools/patcheck index 5416603e19..e21a9f681d 100755 --- a/tools/patcheck +++ b/tools/patcheck @@ -16,7 +16,7 @@ echo patCHeck 1e10.0 echo This tool is intended to help a human check/review patches it is very far from echo being free of false positives and negatives, its output are just hints of what echo may or may not be bad. When you use it and it misses something or detects -echo something wrong, fix it and send a patch to the ffmpeg-dev ML +echo something wrong, fix it and send a patch to the libav-devel mailing list. echo License:GPL Autor: Michael Niedermayer ERE_PRITYP='(unsigned *|)(char|short|long|int|long *int|short *int|void|float|double|(u|)int(8|16|32|64)_t)' From 58bb6b7d9327eeed4d450e23c1316c439b6204a9 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 16 Apr 2011 15:07:14 -0400 Subject: [PATCH 5/9] 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(-) diff --git a/libavcodec/vc1.h b/libavcodec/vc1.h index d0c0cccfb0..db8a7f42b2 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 8200cde0ff..94fbffbc6b 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); From 0b05864eef3d5323ee02515e3b62693230f7e4fb Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 16 Apr 2011 19:29:05 +0000 Subject: [PATCH 6/9] 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(-) diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 94fbffbc6b..6e73317451 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]); From 4c64c8e95a02b1d69aabb400fa73cba7ef8f41f7 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Sun, 17 Apr 2011 12:26:47 -0400 Subject: [PATCH 7/9] 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(-) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 704c6e03a6..99e5b50acb 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 396df87fed..015ebaebec 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); From 6001dad6e2eb654fba9bf3d6bda6a3734253cbc6 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 15 Apr 2011 22:30:26 +0200 Subject: [PATCH 8/9] Replace more FFmpeg references by Libav. --- doc/muxers.texi | 2 +- 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 +- libavfilter/vf_fade.c | 8 ++++---- libavformat/avformat.h | 2 +- libavformat/avidec.c | 2 +- libavformat/mpegtsenc.c | 2 +- libavformat/mxfenc.c | 2 +- libavformat/oggparsespeex.c | 2 +- libavutil/error.c | 2 +- libavutil/error.h | 2 +- 27 files changed, 40 insertions(+), 40 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index ead986914c..82f17ba105 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -167,7 +167,7 @@ Set the first PID for data packets (default 0x0100, max 0x0f00). The recognized metadata settings in mpegts muxer are @code{service_provider} and @code{service_name}. If they are not set the default for -@code{service_provider} is "FFmpeg" and the default for +@code{service_provider} is "Libav" and the default for @code{service_name} is "Service01". @example diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index ddaf0205de..215c1e4241 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 e4f06a7ffa..0b87d28e8b 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 6f08a84044..5db5d0bc9f 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 f9dc7205b8..d99bb0a1f7 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 adaa0a3d96..69cc1d3266 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 9430dcc846..7f7912238d 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 3670e57587..08fec3dfec 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 672745a633..ee29704d92 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 cc614e3d8e..86cc09ffa6 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 133d26ffd7..0f3ae596ed 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 958ed5aaf1..6c3ed8ce56 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 427e9e4200..857538868d 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 805e4ef651..3d57a2173a 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 85e2a503eb..1b3817a14b 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 5bce82992d..8effa7ecd2 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 4abdd5a070..1a470a1e91 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 748fbd66fe..74933af4d5 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 ea8260c482..33c34a0882 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. */ diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index 203a18656e..b3cccbde0b 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -2,20 +2,20 @@ * Copyright (c) 2010 Brandon Mintern * Copyright (c) 2007 Bobby Bingham * - * 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/libavformat/avformat.h b/libavformat/avformat.h index 77114e62e6..55808f13b8 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -742,7 +742,7 @@ typedef struct AVFormatContext { /** * Decoding: total stream bitrate in bit/s, 0 if not * available. Never set it directly if the file_size and the - * duration are known as FFmpeg can compute it automatically. + * duration are known as Libav can compute it automatically. */ int bit_rate; diff --git a/libavformat/avidec.c b/libavformat/avidec.c index c7bbf422b7..43d72ce400 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -588,7 +588,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) /* Extract palette from extradata if bpp <= 8. */ /* This code assumes that extradata contains only palette. */ - /* This is true for all paletted codecs implemented in FFmpeg. */ + /* This is true for all paletted codecs implemented in Libav. */ if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { #if HAVE_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 35db93be40..2ffbd542fa 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -181,7 +181,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, /*********************************************/ /* mpegts writer */ -#define DEFAULT_PROVIDER_NAME "FFmpeg" +#define DEFAULT_PROVIDER_NAME "Libav" #define DEFAULT_SERVICE_NAME "Service01" /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 44052a0610..c448e14b00 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -499,7 +499,7 @@ static void mxf_write_identification(AVFormatContext *s) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; - const char *company = "FFmpeg"; + const char *company = "Libav"; const char *product = "OP1a Muxer"; const char *version; int length; diff --git a/libavformat/oggparsespeex.c b/libavformat/oggparsespeex.c index 80b2001ddf..2f4aec7f07 100644 --- a/libavformat/oggparsespeex.c +++ b/libavformat/oggparsespeex.c @@ -59,7 +59,7 @@ static int speex_header(AVFormatContext *s, int idx) { st->codec->channels = AV_RL32(p + 48); /* We treat the whole Speex packet as a single frame everywhere Speex - is handled in FFmpeg. This avoids the complexities of splitting + is handled in Libav. This avoids the complexities of splitting and joining individual Speex frames, which are not always byte-aligned. */ st->codec->frame_size = AV_RL32(p + 56); diff --git a/libavutil/error.c b/libavutil/error.c index 23e7e13670..978e5431e9 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -28,7 +28,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) case AVERROR_EOF: errstr = "End of file"; break; case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; - case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; + case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break; case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break; case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break; case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"; break; diff --git a/libavutil/error.h b/libavutil/error.h index 087c08fc5e..8c83ecde77 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -50,7 +50,7 @@ #define AVERROR_EOF AVERROR(EPIPE) ///< End of file -#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome #if LIBAVUTIL_VERSION_MAJOR > 50 #define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input From fd0c3403f611d31b944216cfa1585a2d28f7f0da Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sun, 17 Apr 2011 22:18:00 +0200 Subject: [PATCH 9/9] Update regtest checksums after revision 6001dad. The string "FFmpeg" was replaced by "Libav" in metadata that got encoded in file headers. --- tests/ref/lavf/mxf | 4 ++-- tests/ref/lavf/ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf index 58e75d17cd..d4bbe2f25e 100644 --- a/tests/ref/lavf/mxf +++ b/tests/ref/lavf/mxf @@ -1,6 +1,6 @@ -785e38ddd2466046f30aa36399b8f8fa *./tests/data/lavf/lavf.mxf +6e9bd63c5cadd7550ad313553ebf665f *./tests/data/lavf/lavf.mxf 525881 ./tests/data/lavf/lavf.mxf ./tests/data/lavf/lavf.mxf CRC=0x4ace0849 -b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/lavf/lavf.mxf_d10 +e7168856f2b54c6272685967e707fb21 *./tests/data/lavf/lavf.mxf_d10 5330989 ./tests/data/lavf/lavf.mxf_d10 ./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e diff --git a/tests/ref/lavf/ts b/tests/ref/lavf/ts index e4bdb631df..4028be0a6e 100644 --- a/tests/ref/lavf/ts +++ b/tests/ref/lavf/ts @@ -1,3 +1,3 @@ -e8d609b8a5b5854a4485718434b287f7 *./tests/data/lavf/lavf.ts +1cebaf8b13700a3360e0c32551e36646 *./tests/data/lavf/lavf.ts 406644 ./tests/data/lavf/lavf.ts ./tests/data/lavf/lavf.ts CRC=0x133216c1