summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:36:57 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-17 23:43:54 +0200
commitc40798441f47341c310b38e8f329cfb943924faf (patch)
treec23fbec614c59bcf14c7377d1c6ff7abdfa34353 /libavcodec
parentc96786008172f669e546ca987e7aaa3c3469be71 (diff)
parentfd0c3403f611d31b944216cfa1585a2d28f7f0da (diff)
downloadffmpeg-streaming-c40798441f47341c310b38e8f329cfb943924faf.zip
ffmpeg-streaming-c40798441f47341c310b38e8f329cfb943924faf.tar.gz
Merge remote branch 'qatar/master'
* qatar/master: ac3dec: fix processing of delta bit allocation information. vc1: fix fate-vc1 after previous commit. wmv3dec: fix playback of complex WMV3 files using simple_idct. make av_dup_packet() more cautious on allocation failures make containers pass palette change in AVPacket introduce side information for AVPacket Politic commits that have not been pulled: Update regtest checksums after revision 6001dad. Replace more FFmpeg references by Libav. Replace references to ffmpeg-devel with libav-devel; fix roundup URL. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/8bps.c21
-rw-r--r--libavcodec/ac3.c4
-rw-r--r--libavcodec/ac3dec.c4
-rw-r--r--libavcodec/avcodec.h37
-rw-r--r--libavcodec/avpacket.c103
-rw-r--r--libavcodec/cinepak.c19
-rw-r--r--libavcodec/dsputil.c2
-rw-r--r--libavcodec/dv.c4
-rw-r--r--libavcodec/dxva2.h2
-rw-r--r--libavcodec/dxva2_h264.c8
-rw-r--r--libavcodec/idcinvideo.c12
-rw-r--r--libavcodec/interplayvideo.c21
-rw-r--r--libavcodec/jpeglsdec.c2
-rw-r--r--libavcodec/kmvc.c16
-rw-r--r--libavcodec/libdirac.h2
-rw-r--r--libavcodec/libdiracdec.c4
-rw-r--r--libavcodec/libschroedingerdec.c4
-rw-r--r--libavcodec/libtheoraenc.c2
-rw-r--r--libavcodec/mimic.c2
-rw-r--r--libavcodec/msrle.c17
-rw-r--r--libavcodec/msvideo1.c24
-rw-r--r--libavcodec/qpeg.c12
-rw-r--r--libavcodec/qtrle.c12
-rw-r--r--libavcodec/rawdec.c10
-rw-r--r--libavcodec/smc.c13
-rw-r--r--libavcodec/targa.c7
-rw-r--r--libavcodec/truemotion2.c2
-rw-r--r--libavcodec/tscc.c10
-rw-r--r--libavcodec/utils.c2
-rw-r--r--libavcodec/vaapi_h264.c2
-rw-r--r--libavcodec/vaapi_mpeg4.c2
-rw-r--r--libavcodec/vaapi_vc1.c4
-rw-r--r--libavcodec/vc1.h1
-rw-r--r--libavcodec/vc1dec.c91
-rw-r--r--libavcodec/version.h12
-rw-r--r--libavcodec/vorbis_enc.c2
-rw-r--r--libavcodec/wmavoice.c2
37 files changed, 315 insertions, 179 deletions
diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index 4757057..d5f550f 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/ac3.c b/libavcodec/ac3.c
index dc7cbb3..29e132f 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 5ef576a..b2e4f81 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1175,8 +1175,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);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0bb11c1..07bae87 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1046,6 +1046,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
@@ -1068,6 +1072,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.
*/
@@ -3224,6 +3239,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 82890c3..ada73a5 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,23 +100,52 @@ int av_grow_packet(AVPacket *pkt, int grow_by)
return 0;
}
+#define DUP_DATA(dst, src, size, padding) \
+ do { \
+ void *data; \
+ if (padding) { \
+ if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \
+ goto failed_alloc; \
+ data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \
+ } else { \
+ data = av_malloc(size); \
+ } \
+ if (!data) \
+ goto failed_alloc; \
+ memcpy(data, src, size); \
+ if (padding) \
+ memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \
+ dst = data; \
+ } while(0)
+
int av_dup_packet(AVPacket *pkt)
{
+ AVPacket tmp_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;
+ 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, 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, 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)
@@ -113,5 +153,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/cinepak.c b/libavcodec/cinepak.c
index 52fde64..bbff22b 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/dsputil.c b/libavcodec/dsputil.c
index 90e6440..75ddd32 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2844,7 +2844,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 6a49147..86e6fe5 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 5c5fe21..8bb78e1 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 17fb2b5..af9880c 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/idcinvideo.c b/libavcodec/idcinvideo.c
index 64421db..ab06972 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 18702b2..d2b8345 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/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 7278e02..d312100 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/kmvc.c b/libavcodec/kmvc.c
index bd628d8..1042cc4 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/libdirac.h b/libavcodec/libdirac.h
index 0dc19ca..dcf901b 100644
--- a/libavcodec/libdirac.h
+++ b/libavcodec/libdirac.h
@@ -30,7 +30,7 @@
#include <libdirac_common/dirac_types.h>
/**
-* 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 fb6ff45..6095665 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 7603f7e..c0c3d11 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 87793ad..e57fda2 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 2f3f9d9..b8dbdb2 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/msrle.c b/libavcodec/msrle.c
index f1fa8f5..a263318 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 <stdio.h>
@@ -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 d40304d..f7434a3 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 <stdio.h>
@@ -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 e4c2291..dda5525 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 8ad6778..8b0c726 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 e142369..d9993c0 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 f8b994c..3f1b974 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 3c220f4..5514304 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/truemotion2.c b/libavcodec/truemotion2.c
index 86454ec..31c59e4 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/tscc.c b/libavcodec/tscc.c
index 9de53a7..dc344a1 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/libavcodec/utils.c b/libavcodec/utils.c
index a6fb871..9e26660 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1247,7 +1247,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 34e4976..cce2627 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 78e0d64..bd0909e 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 b1dfde8..8b9ab0d 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/vc1.h b/libavcodec/vc1.h
index 261ac54..19be3c3 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 41322ef..27695f1 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->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]);
+ 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);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0e2d766..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
*/
@@ -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, \
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index d15d345..4046331 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 dfdfabb..b1aea9f 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. */
OpenPOWER on IntegriCloud