summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-14 21:49:01 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-14 22:37:43 +0200
commit7432bcfe5a36331502c49fe03aefe39b9936247a (patch)
tree398b1874abbd4bcf7c103738ac4548e830af0a43 /libavcodec
parent01bf2ad7351fdaa2e21b6bdf963d22d6ffccb920 (diff)
parent7bf9e3391fa21d90ff283fc03a12287fe73db9e8 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: vsrc_buffer: fix check from 7ae7c41. libxvid: Reorder functions to avoid forward declarations; make functions static. libxvid: drop some pointless dead code wmal: vertical alignment cosmetics wmal: Warn about missing bitstream splicing feature and ask for sample. wmal: Skip seekable_frame_in_packet. wmal: Drop unused variable num_possible_block_size. avfiltergraph: make the AVFilterInOut alloc/free API public graphparser: allow specifying sws flags in the graph description. graphparser: fix the order of connecting unlabeled links. graphparser: add avfilter_graph_parse2(). vsrc_buffer: allow using a NULL buffer to signal EOF. swscale: handle last pixel if lines have an odd width. qdm2: fix a dubious pointer cast WMAL: Do not try to read rawpcm coefficients if bits is invalid mov: Fix detecting there is no sync sample. tiffdec: K&R cosmetics avf: has_duration does not check the global one dsputil: fix optimized emu_edge function on Win64. Conflicts: doc/APIchanges libavcodec/libxvid_rc.c libavcodec/libxvidff.c libavcodec/tiff.c libavcodec/wmalosslessdec.c libavfilter/avfiltergraph.h libavfilter/graphparser.c libavfilter/version.h libavfilter/vsrc_buffer.c libswscale/output.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libxvid_rc.c5
-rw-r--r--libavcodec/libxvidff.c541
-rw-r--r--libavcodec/qdm2.c11
-rw-r--r--libavcodec/tiff.c253
-rw-r--r--libavcodec/wmalosslessdec.c19
-rw-r--r--libavcodec/x86/dsputil_yasm.asm2
6 files changed, 432 insertions, 399 deletions
diff --git a/libavcodec/libxvid_rc.c b/libavcodec/libxvid_rc.c
index a9a1ee971d..71579ebe7a 100644
--- a/libavcodec/libxvid_rc.c
+++ b/libavcodec/libxvid_rc.c
@@ -31,16 +31,12 @@
#undef NDEBUG
#include <assert.h>
-extern unsigned int xvid_debug;
-
int ff_xvid_rate_control_init(MpegEncContext *s){
char *tmp_name;
int fd, i;
xvid_plg_create_t xvid_plg_create = { 0 };
xvid_plugin_2pass2_t xvid_2pass2 = { 0 };
-//xvid_debug=-1;
-
fd=av_tempfile("xvidrc.", &tmp_name, 0, s->avctx);
if (fd == -1) {
av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
@@ -58,7 +54,6 @@ int ff_xvid_rate_control_init(MpegEncContext *s){
frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count,
rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);
-//av_log(NULL, AV_LOG_ERROR, "%s\n", tmp);
if (write(fd, tmp, strlen(tmp)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", strerror(errno));
return AVERROR(errno);
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index 811efc3793..0426e9de14 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -72,11 +72,276 @@ struct xvid_ff_pass1 {
struct xvid_context *context; /**< Pointer to private context */
};
-/* Prototypes - See function implementation for details */
-int xvid_strip_vol_header(AVCodecContext *avctx, AVPacket *pkt, unsigned int header_len, unsigned int frame_len);
-int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2);
-void xvid_correct_framerate(AVCodecContext *avctx);
+/*
+ * Xvid 2-Pass Kludge Section
+ *
+ * Xvid's default 2-pass doesn't allow us to create data as we need to, so
+ * this section spends time replacing the first pass plugin so we can write
+ * statistic information as libavcodec requests in. We have another kludge
+ * that allows us to pass data to the second pass in Xvid without a custom
+ * rate-control plugin.
+ */
+
+
+/**
+ * Initialize the two-pass plugin and context.
+ *
+ * @param param Input construction parameter structure
+ * @param handle Private context handle
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success.
+ */
+static int xvid_ff_2pass_create(xvid_plg_create_t * param,
+ void ** handle) {
+ struct xvid_ff_pass1 *x = (struct xvid_ff_pass1 *)param->param;
+ char *log = x->context->twopassbuffer;
+
+ /* Do a quick bounds check */
+ if( log == NULL )
+ return XVID_ERR_FAIL;
+
+ /* We use snprintf() */
+ /* This is because we can safely prevent a buffer overflow */
+ log[0] = 0;
+ snprintf(log, BUFFER_REMAINING(log),
+ "# ffmpeg 2-pass log file, using xvid codec\n");
+ snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
+ "# Do not modify. libxvidcore version: %d.%d.%d\n\n",
+ XVID_VERSION_MAJOR(XVID_VERSION),
+ XVID_VERSION_MINOR(XVID_VERSION),
+ XVID_VERSION_PATCH(XVID_VERSION));
+
+ *handle = x->context;
+ return 0;
+}
+
+/**
+ * Destroy the two-pass plugin context.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Destrooy context
+ * @return Returns 0, success guaranteed
+ */
+static int xvid_ff_2pass_destroy(struct xvid_context *ref,
+ xvid_plg_destroy_t *param) {
+ /* Currently cannot think of anything to do on destruction */
+ /* Still, the framework should be here for reference/use */
+ if( ref->twopassbuffer != NULL )
+ ref->twopassbuffer[0] = 0;
+ return 0;
+}
+
+/**
+ * Enable fast encode mode during the first pass.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Frame data
+ * @return Returns 0, success guaranteed
+ */
+static int xvid_ff_2pass_before(struct xvid_context *ref,
+ xvid_plg_data_t *param) {
+ int motion_remove;
+ int motion_replacements;
+ int vop_remove;
+
+ /* Nothing to do here, result is changed too much */
+ if( param->zone && param->zone->mode == XVID_ZONE_QUANT )
+ return 0;
+
+ /* We can implement a 'turbo' first pass mode here */
+ param->quant = 2;
+
+ /* Init values */
+ motion_remove = ~XVID_ME_CHROMA_PVOP &
+ ~XVID_ME_CHROMA_BVOP &
+ ~XVID_ME_EXTSEARCH16 &
+ ~XVID_ME_ADVANCEDDIAMOND16;
+ motion_replacements = XVID_ME_FAST_MODEINTERPOLATE |
+ XVID_ME_SKIP_DELTASEARCH |
+ XVID_ME_FASTREFINE16 |
+ XVID_ME_BFRAME_EARLYSTOP;
+ vop_remove = ~XVID_VOP_MODEDECISION_RD &
+ ~XVID_VOP_FAST_MODEDECISION_RD &
+ ~XVID_VOP_TRELLISQUANT &
+ ~XVID_VOP_INTER4V &
+ ~XVID_VOP_HQACPRED;
+
+ param->vol_flags &= ~XVID_VOL_GMC;
+ param->vop_flags &= vop_remove;
+ param->motion_flags &= motion_remove;
+ param->motion_flags |= motion_replacements;
+
+ return 0;
+}
+
+/**
+ * Capture statistic data and write it during first pass.
+ *
+ * @param ref Context pointer for the plugin
+ * @param param Statistic data
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success
+ */
+static int xvid_ff_2pass_after(struct xvid_context *ref,
+ xvid_plg_data_t *param) {
+ char *log = ref->twopassbuffer;
+ const char *frame_types = " ipbs";
+ char frame_type;
+
+ /* Quick bounds check */
+ if( log == NULL )
+ return XVID_ERR_FAIL;
+
+ /* Convert the type given to us into a character */
+ if( param->type < 5 && param->type > 0 ) {
+ frame_type = frame_types[param->type];
+ } else {
+ return XVID_ERR_FAIL;
+ }
+
+ snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
+ "%c %d %d %d %d %d %d\n",
+ frame_type, param->stats.quant, param->stats.kblks, param->stats.mblks,
+ param->stats.ublks, param->stats.length, param->stats.hlength);
+
+ return 0;
+}
+
+/**
+ * Dispatch function for our custom plugin.
+ * This handles the dispatch for the Xvid plugin. It passes data
+ * on to other functions for actual processing.
+ *
+ * @param ref Context pointer for the plugin
+ * @param cmd The task given for us to complete
+ * @param p1 First parameter (varies)
+ * @param p2 Second parameter (varies)
+ * @return Returns XVID_ERR_xxxx on failure, or 0 on success
+ */
+static int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2)
+{
+ switch( cmd ) {
+ case XVID_PLG_INFO:
+ case XVID_PLG_FRAME:
+ return 0;
+
+ case XVID_PLG_BEFORE:
+ return xvid_ff_2pass_before(ref, p1);
+
+ case XVID_PLG_CREATE:
+ return xvid_ff_2pass_create(p1, p2);
+ case XVID_PLG_AFTER:
+ return xvid_ff_2pass_after(ref, p1);
+
+ case XVID_PLG_DESTROY:
+ return xvid_ff_2pass_destroy(ref, p1);
+
+ default:
+ return XVID_ERR_FAIL;
+ }
+}
+
+/**
+ * Routine to create a global VO/VOL header for MP4 container.
+ * What we do here is extract the header from the Xvid bitstream
+ * as it is encoded. We also strip the repeated headers from the
+ * bitstream when a global header is requested for MPEG-4 ISO
+ * compliance.
+ *
+ * @param avctx AVCodecContext pointer to context
+ * @param frame Pointer to encoded frame data
+ * @param header_len Length of header to search
+ * @param frame_len Length of encoded frame data
+ * @return Returns new length of frame data
+ */
+static int xvid_strip_vol_header(AVCodecContext *avctx,
+ AVPacket *pkt,
+ unsigned int header_len,
+ unsigned int frame_len) {
+ int vo_len = 0, i;
+
+ for( i = 0; i < header_len - 3; i++ ) {
+ if( pkt->data[i] == 0x00 &&
+ pkt->data[i+1] == 0x00 &&
+ pkt->data[i+2] == 0x01 &&
+ pkt->data[i+3] == 0xB6 ) {
+ vo_len = i;
+ break;
+ }
+ }
+
+ if( vo_len > 0 ) {
+ /* We need to store the header, so extract it */
+ if( avctx->extradata == NULL ) {
+ avctx->extradata = av_malloc(vo_len);
+ memcpy(avctx->extradata, pkt->data, vo_len);
+ avctx->extradata_size = vo_len;
+ }
+ /* Less dangerous now, memmove properly copies the two
+ chunks of overlapping data */
+ memmove(pkt->data, &pkt->data[vo_len], frame_len - vo_len);
+ pkt->size = frame_len - vo_len;
+ }
+ return 0;
+}
+
+/**
+ * Routine to correct a possibly erroneous framerate being fed to us.
+ * Xvid currently chokes on framerates where the ticks per frame is
+ * extremely large. This function works to correct problems in this area
+ * by estimating a new framerate and taking the simpler fraction of
+ * the two presented.
+ *
+ * @param avctx Context that contains the framerate to correct.
+ */
+static void xvid_correct_framerate(AVCodecContext *avctx)
+{
+ int frate, fbase;
+ int est_frate, est_fbase;
+ int gcd;
+ float est_fps, fps;
+
+ frate = avctx->time_base.den;
+ fbase = avctx->time_base.num;
+
+ gcd = av_gcd(frate, fbase);
+ if( gcd > 1 ) {
+ frate /= gcd;
+ fbase /= gcd;
+ }
+
+ if( frate <= 65000 && fbase <= 65000 ) {
+ avctx->time_base.den = frate;
+ avctx->time_base.num = fbase;
+ return;
+ }
+
+ fps = (float)frate / (float)fbase;
+ est_fps = roundf(fps * 1000.0) / 1000.0;
+
+ est_frate = (int)est_fps;
+ if( est_fps > (int)est_fps ) {
+ est_frate = (est_frate + 1) * 1000;
+ est_fbase = (int)roundf((float)est_frate / est_fps);
+ } else
+ est_fbase = 1;
+
+ gcd = av_gcd(est_frate, est_fbase);
+ if( gcd > 1 ) {
+ est_frate /= gcd;
+ est_fbase /= gcd;
+ }
+
+ if( fbase > est_fbase ) {
+ avctx->time_base.den = est_frate;
+ avctx->time_base.num = est_fbase;
+ av_log(avctx, AV_LOG_DEBUG,
+ "Xvid: framerate re-estimated: %.2f, %.3f%% correction\n",
+ est_fps, (((est_fps - fps)/fps) * 100.0));
+ } else {
+ avctx->time_base.den = frate;
+ avctx->time_base.num = fbase;
+ }
+}
/**
* Create the private context for the encoder.
@@ -509,274 +774,6 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) {
}
/**
- * Routine to create a global VO/VOL header for MP4 container.
- * What we do here is extract the header from the Xvid bitstream
- * as it is encoded. We also strip the repeated headers from the
- * bitstream when a global header is requested for MPEG-4 ISO
- * compliance.
- *
- * @param avctx AVCodecContext pointer to context
- * @param frame Pointer to encoded frame data
- * @param header_len Length of header to search
- * @param frame_len Length of encoded frame data
- * @return Returns new length of frame data
- */
-int xvid_strip_vol_header(AVCodecContext *avctx,
- AVPacket *pkt,
- unsigned int header_len,
- unsigned int frame_len) {
- int vo_len = 0, i;
-
- for( i = 0; i < header_len - 3; i++ ) {
- if( pkt->data[i] == 0x00 &&
- pkt->data[i+1] == 0x00 &&
- pkt->data[i+2] == 0x01 &&
- pkt->data[i+3] == 0xB6 ) {
- vo_len = i;
- break;
- }
- }
-
- if( vo_len > 0 ) {
- /* We need to store the header, so extract it */
- if( avctx->extradata == NULL ) {
- avctx->extradata = av_malloc(vo_len);
- memcpy(avctx->extradata, pkt->data, vo_len);
- avctx->extradata_size = vo_len;
- }
- /* Less dangerous now, memmove properly copies the two
- chunks of overlapping data */
- memmove(pkt->data, &pkt->data[vo_len], frame_len - vo_len);
- pkt->size = frame_len - vo_len;
- }
- return 0;
-}
-
-/**
- * Routine to correct a possibly erroneous framerate being fed to us.
- * Xvid currently chokes on framerates where the ticks per frame is
- * extremely large. This function works to correct problems in this area
- * by estimating a new framerate and taking the simpler fraction of
- * the two presented.
- *
- * @param avctx Context that contains the framerate to correct.
- */
-void xvid_correct_framerate(AVCodecContext *avctx) {
- int frate, fbase;
- int est_frate, est_fbase;
- int gcd;
- float est_fps, fps;
-
- frate = avctx->time_base.den;
- fbase = avctx->time_base.num;
-
- gcd = av_gcd(frate, fbase);
- if( gcd > 1 ) {
- frate /= gcd;
- fbase /= gcd;
- }
-
- if( frate <= 65000 && fbase <= 65000 ) {
- avctx->time_base.den = frate;
- avctx->time_base.num = fbase;
- return;
- }
-
- fps = (float)frate / (float)fbase;
- est_fps = roundf(fps * 1000.0) / 1000.0;
-
- est_frate = (int)est_fps;
- if( est_fps > (int)est_fps ) {
- est_frate = (est_frate + 1) * 1000;
- est_fbase = (int)roundf((float)est_frate / est_fps);
- } else
- est_fbase = 1;
-
- gcd = av_gcd(est_frate, est_fbase);
- if( gcd > 1 ) {
- est_frate /= gcd;
- est_fbase /= gcd;
- }
-
- if( fbase > est_fbase ) {
- avctx->time_base.den = est_frate;
- avctx->time_base.num = est_fbase;
- av_log(avctx, AV_LOG_DEBUG,
- "Xvid: framerate re-estimated: %.2f, %.3f%% correction\n",
- est_fps, (((est_fps - fps)/fps) * 100.0));
- } else {
- avctx->time_base.den = frate;
- avctx->time_base.num = fbase;
- }
-}
-
-/*
- * Xvid 2-Pass Kludge Section
- *
- * Xvid's default 2-pass doesn't allow us to create data as we need to, so
- * this section spends time replacing the first pass plugin so we can write
- * statistic information as libavcodec requests in. We have another kludge
- * that allows us to pass data to the second pass in Xvid without a custom
- * rate-control plugin.
- */
-
-/**
- * Initialize the two-pass plugin and context.
- *
- * @param param Input construction parameter structure
- * @param handle Private context handle
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success.
- */
-static int xvid_ff_2pass_create(xvid_plg_create_t * param,
- void ** handle) {
- struct xvid_ff_pass1 *x = (struct xvid_ff_pass1 *)param->param;
- char *log = x->context->twopassbuffer;
-
- /* Do a quick bounds check */
- if( log == NULL )
- return XVID_ERR_FAIL;
-
- /* We use snprintf() */
- /* This is because we can safely prevent a buffer overflow */
- log[0] = 0;
- snprintf(log, BUFFER_REMAINING(log),
- "# ffmpeg 2-pass log file, using xvid codec\n");
- snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
- "# Do not modify. libxvidcore version: %d.%d.%d\n\n",
- XVID_VERSION_MAJOR(XVID_VERSION),
- XVID_VERSION_MINOR(XVID_VERSION),
- XVID_VERSION_PATCH(XVID_VERSION));
-
- *handle = x->context;
- return 0;
-}
-
-/**
- * Destroy the two-pass plugin context.
- *
- * @param ref Context pointer for the plugin
- * @param param Destrooy context
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_destroy(struct xvid_context *ref,
- xvid_plg_destroy_t *param) {
- /* Currently cannot think of anything to do on destruction */
- /* Still, the framework should be here for reference/use */
- if( ref->twopassbuffer != NULL )
- ref->twopassbuffer[0] = 0;
- return 0;
-}
-
-/**
- * Enable fast encode mode during the first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Frame data
- * @return Returns 0, success guaranteed
- */
-static int xvid_ff_2pass_before(struct xvid_context *ref,
- xvid_plg_data_t *param) {
- int motion_remove;
- int motion_replacements;
- int vop_remove;
-
- /* Nothing to do here, result is changed too much */
- if( param->zone && param->zone->mode == XVID_ZONE_QUANT )
- return 0;
-
- /* We can implement a 'turbo' first pass mode here */
- param->quant = 2;
-
- /* Init values */
- motion_remove = ~XVID_ME_CHROMA_PVOP &
- ~XVID_ME_CHROMA_BVOP &
- ~XVID_ME_EXTSEARCH16 &
- ~XVID_ME_ADVANCEDDIAMOND16;
- motion_replacements = XVID_ME_FAST_MODEINTERPOLATE |
- XVID_ME_SKIP_DELTASEARCH |
- XVID_ME_FASTREFINE16 |
- XVID_ME_BFRAME_EARLYSTOP;
- vop_remove = ~XVID_VOP_MODEDECISION_RD &
- ~XVID_VOP_FAST_MODEDECISION_RD &
- ~XVID_VOP_TRELLISQUANT &
- ~XVID_VOP_INTER4V &
- ~XVID_VOP_HQACPRED;
-
- param->vol_flags &= ~XVID_VOL_GMC;
- param->vop_flags &= vop_remove;
- param->motion_flags &= motion_remove;
- param->motion_flags |= motion_replacements;
-
- return 0;
-}
-
-/**
- * Capture statistic data and write it during first pass.
- *
- * @param ref Context pointer for the plugin
- * @param param Statistic data
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-static int xvid_ff_2pass_after(struct xvid_context *ref,
- xvid_plg_data_t *param) {
- char *log = ref->twopassbuffer;
- const char *frame_types = " ipbs";
- char frame_type;
-
- /* Quick bounds check */
- if( log == NULL )
- return XVID_ERR_FAIL;
-
- /* Convert the type given to us into a character */
- if( param->type < 5 && param->type > 0 ) {
- frame_type = frame_types[param->type];
- } else {
- return XVID_ERR_FAIL;
- }
-
- snprintf(BUFFER_CAT(log), BUFFER_REMAINING(log),
- "%c %d %d %d %d %d %d\n",
- frame_type, param->stats.quant, param->stats.kblks, param->stats.mblks,
- param->stats.ublks, param->stats.length, param->stats.hlength);
-
- return 0;
-}
-
-/**
- * Dispatch function for our custom plugin.
- * This handles the dispatch for the Xvid plugin. It passes data
- * on to other functions for actual processing.
- *
- * @param ref Context pointer for the plugin
- * @param cmd The task given for us to complete
- * @param p1 First parameter (varies)
- * @param p2 Second parameter (varies)
- * @return Returns XVID_ERR_xxxx on failure, or 0 on success
- */
-int xvid_ff_2pass(void *ref, int cmd, void *p1, void *p2) {
- switch( cmd ) {
- case XVID_PLG_INFO:
- case XVID_PLG_FRAME:
- return 0;
-
- case XVID_PLG_BEFORE:
- return xvid_ff_2pass_before(ref, p1);
-
- case XVID_PLG_CREATE:
- return xvid_ff_2pass_create(p1, p2);
-
- case XVID_PLG_AFTER:
- return xvid_ff_2pass_after(ref, p1);
-
- case XVID_PLG_DESTROY:
- return xvid_ff_2pass_destroy(ref, p1);
-
- default:
- return XVID_ERR_FAIL;
- }
-}
-
-/**
* Xvid codec definition for libavcodec.
*/
AVCodec ff_libxvid_encoder = {
diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index bfac583973..74a138bc70 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -140,7 +140,6 @@ typedef struct {
/// Parameters built from header parameters, do not change during playback
int group_order; ///< order of frame group
int fft_order; ///< order of FFT (actually fftorder+1)
- int fft_frame_size; ///< size of fft frame, in components (1 comples = re + im)
int frame_size; ///< size of data frame
int frequency_range;
int sub_sampling; ///< subsampling: 0=25%, 1=50%, 2=100% */
@@ -1607,13 +1606,17 @@ static void qdm2_fft_tone_synthesizer (QDM2Context *q, int sub_packet)
static void qdm2_calculate_fft (QDM2Context *q, int channel, int sub_packet)
{
const float gain = (q->channels == 1 && q->nb_channels == 2) ? 0.5f : 1.0f;
+ float *out = q->output_buffer + channel;
int i;
q->fft.complex[channel][0].re *= 2.0f;
q->fft.complex[channel][0].im = 0.0f;
q->rdft_ctx.rdft_calc(&q->rdft_ctx, (FFTSample *)q->fft.complex[channel]);
/* add samples to output buffer */
- for (i = 0; i < ((q->fft_frame_size + 15) & ~15); i++)
- q->output_buffer[q->channels * i + channel] += ((float *) q->fft.complex[channel])[i] * gain;
+ for (i = 0; i < FFALIGN(q->fft_size, 8); i++) {
+ out[0] += q->fft.complex[channel][i].re * gain;
+ out[q->channels] += q->fft.complex[channel][i].im * gain;
+ out += 2 * q->channels;
+ }
}
@@ -1688,7 +1691,6 @@ static void dump_context(QDM2Context *q)
PRINT("checksum_size",q->checksum_size);
PRINT("channels",q->channels);
PRINT("nb_channels",q->nb_channels);
- PRINT("fft_frame_size",q->fft_frame_size);
PRINT("fft_size",q->fft_size);
PRINT("sub_sampling",q->sub_sampling);
PRINT("fft_order",q->fft_order);
@@ -1843,7 +1845,6 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
}
s->fft_order = av_log2(s->fft_size) + 1;
- s->fft_frame_size = 2 * s->fft_size; // complex has two floats
// something like max decodable tones
s->group_order = av_log2(s->group_size) + 1;
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 0d79f6192b..8de1ebd1bf 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -52,35 +52,39 @@ typedef struct TiffContext {
int strips, rps, sstype;
int sot;
- const uint8_t* stripdata;
- const uint8_t* stripsizes;
+ const uint8_t *stripdata;
+ const uint8_t *stripsizes;
int stripsize, stripoff;
LZWState *lzw;
} TiffContext;
-static unsigned tget_short(const uint8_t **p, int le) {
+static unsigned tget_short(const uint8_t **p, int le)
+{
unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
*p += 2;
return v;
}
-static unsigned tget_long(const uint8_t **p, int le) {
+static unsigned tget_long(const uint8_t **p, int le)
+{
unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
*p += 4;
return v;
}
-static unsigned tget(const uint8_t **p, int type, int le) {
- switch(type){
+static unsigned tget(const uint8_t **p, int type, int le)
+{
+ switch (type) {
case TIFF_BYTE : return *(*p)++;
case TIFF_SHORT: return tget_short(p, le);
- case TIFF_LONG : return tget_long (p, le);
+ case TIFF_LONG : return tget_long(p, le);
default : return UINT_MAX;
}
}
#if CONFIG_ZLIB
-static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src, int size)
+static int tiff_uncompress(uint8_t *dst, unsigned long *len, const uint8_t *src,
+ int size)
{
z_stream zstream = { 0 };
int zret;
@@ -141,7 +145,9 @@ static void av_always_inline horizontal_fill(unsigned int bpp, uint8_t* dst,
}
}
-static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uint8_t *src, int size, int lines){
+static int tiff_unpack_strip(TiffContext *s, uint8_t *dst, int stride,
+ const uint8_t *src, int size, int lines)
+{
int c, line, pixels, code;
const uint8_t *ssrc = src;
int width = ((s->width * s->bpp) + 7) >> 3;
@@ -150,21 +156,24 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
return AVERROR_INVALIDDATA;
#if CONFIG_ZLIB
- if(s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE){
- uint8_t *zbuf; unsigned long outlen;
+ if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
+ uint8_t *zbuf;
+ unsigned long outlen;
int ret;
outlen = width * lines;
zbuf = av_malloc(outlen);
if (!zbuf)
return AVERROR(ENOMEM);
ret = tiff_uncompress(zbuf, &outlen, src, size);
- if(ret != Z_OK){
- av_log(s->avctx, AV_LOG_ERROR, "Uncompressing failed (%lu of %lu) with error %d\n", outlen, (unsigned long)width * lines, ret);
+ if (ret != Z_OK) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Uncompressing failed (%lu of %lu) with error %d\n", outlen,
+ (unsigned long)width * lines, ret);
av_free(zbuf);
return -1;
}
src = zbuf;
- for(line = 0; line < lines; line++){
+ for (line = 0; line < lines; line++) {
if(s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8){
horizontal_fill(s->bpp, dst, 1, src, 0, width, 0);
}else{
@@ -177,37 +186,42 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
return 0;
}
#endif
- if(s->compr == TIFF_LZW){
- if(ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF) < 0){
+ if (s->compr == TIFF_LZW) {
+ if (ff_lzw_decode_init(s->lzw, 8, src, size, FF_LZW_TIFF) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Error initializing LZW decoder\n");
return -1;
}
}
- if(s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3 || s->compr == TIFF_G4){
+ if (s->compr == TIFF_CCITT_RLE || s->compr == TIFF_G3
+ || s->compr == TIFF_G4) {
int i, ret = 0;
- uint8_t *src2 = av_malloc((unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE);
+ uint8_t *src2 = av_malloc((unsigned)size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
if (!src2) {
- av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Error allocating temporary buffer\n");
return AVERROR(ENOMEM);
}
- if(s->fax_opts & 2){
- av_log(s->avctx, AV_LOG_ERROR, "Uncompressed fax mode is not supported (yet)\n");
+ if (s->fax_opts & 2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Uncompressed fax mode is not supported (yet)\n");
av_free(src2);
return -1;
}
- if(!s->fill_order){
+ if (!s->fill_order) {
memcpy(src2, src, size);
- }else{
- for(i = 0; i < size; i++)
+ } else {
+ for (i = 0; i < size; i++)
src2[i] = av_reverse[src[i]];
}
- memset(src2+size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
- switch(s->compr){
+ memset(src2 + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+ switch (s->compr) {
case TIFF_CCITT_RLE:
case TIFF_G3:
case TIFF_G4:
- ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride, s->compr, s->fax_opts);
+ ret = ff_ccitt_unpack(s->avctx, src2, size, dst, lines, stride,
+ s->compr, s->fax_opts);
break;
}
if (s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8)
@@ -218,12 +232,12 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
av_free(src2);
return ret;
}
- for(line = 0; line < lines; line++){
- if(src - ssrc > size){
+ for (line = 0; line < lines; line++) {
+ if (src - ssrc > size) {
av_log(s->avctx, AV_LOG_ERROR, "Source data overread\n");
return -1;
}
- switch(s->compr){
+ switch (s->compr) {
case TIFF_RAW:
if (ssrc + size - src < width)
return AVERROR_INVALIDDATA;
@@ -238,22 +252,24 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
src += width;
break;
case TIFF_PACKBITS:
- for(pixels = 0; pixels < width;){
- code = (int8_t)*src++;
- if(code >= 0){
+ for (pixels = 0; pixels < width;) {
+ code = (int8_t) * src++;
+ if (code >= 0) {
code++;
- if(pixels + code > width){
- av_log(s->avctx, AV_LOG_ERROR, "Copy went out of bounds\n");
+ if (pixels + code > width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Copy went out of bounds\n");
return -1;
}
horizontal_fill(s->bpp * (s->avctx->pix_fmt == PIX_FMT_PAL8),
dst, 1, src, 0, code, pixels);
src += code;
pixels += code;
- }else if(code != -128){ // -127..-1
+ } else if (code != -128) { // -127..-1
code = (-code) + 1;
- if(pixels + code > width){
- av_log(s->avctx, AV_LOG_ERROR, "Run went out of bounds\n");
+ if (pixels + code > width) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Run went out of bounds\n");
return -1;
}
c = *src++;
@@ -265,8 +281,9 @@ static int tiff_unpack_strip(TiffContext *s, uint8_t* dst, int stride, const uin
break;
case TIFF_LZW:
pixels = ff_lzw_decode(s->lzw, dst, width);
- if(pixels < width){
- av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n", pixels, width);
+ if (pixels < width) {
+ av_log(s->avctx, AV_LOG_ERROR, "Decoded only %i bytes of %i\n",
+ pixels, width);
return -1;
}
if (s->bpp < 8 && s->avctx->pix_fmt == PIX_FMT_PAL8)
@@ -342,7 +359,8 @@ static int init_image(TiffContext *s)
return 0;
}
-static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *buf, const uint8_t *end_buf)
+static int tiff_decode_tag(TiffContext *s, const uint8_t *start,
+ const uint8_t *buf, const uint8_t *end_buf)
{
unsigned tag, type, count, off, value = 0;
int i, j;
@@ -357,12 +375,13 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
off = tget_long(&buf, s->le);
if (type == 0 || type >= FF_ARRAY_ELEMS(type_sizes)) {
- av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n", type);
+ av_log(s->avctx, AV_LOG_DEBUG, "Unknown tiff type (%u) encountered\n",
+ type);
return 0;
}
- if(count == 1){
- switch(type){
+ if (count == 1) {
+ switch (type) {
case TIFF_BYTE:
case TIFF_SHORT:
buf -= 4;
@@ -374,7 +393,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
buf = NULL;
break;
case TIFF_STRING:
- if(count <= 4){
+ if (count <= 4) {
buf -= 4;
break;
}
@@ -390,12 +409,13 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
}
}
- if(buf && (buf < start || buf > end_buf)){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (buf && (buf < start || buf > end_buf)) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
- switch(tag){
+ switch (tag) {
case TIFF_WIDTH:
s->width = value;
break;
@@ -404,20 +424,25 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
break;
case TIFF_BPP:
s->bppcount = count;
- if(count > 4){
- av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, %d components)\n", s->bpp, count);
+ if (count > 4) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "This format is not supported (bpp=%d, %d components)\n",
+ s->bpp, count);
return -1;
}
- if(count == 1) s->bpp = value;
- else{
- switch(type){
+ if (count == 1)
+ s->bpp = value;
+ else {
+ switch (type) {
case TIFF_BYTE:
- s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) + ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
+ s->bpp = (off & 0xFF) + ((off >> 8) & 0xFF) +
+ ((off >> 16) & 0xFF) + ((off >> 24) & 0xFF);
break;
case TIFF_SHORT:
case TIFF_LONG:
s->bpp = 0;
- for(i = 0; i < count && buf < end_buf; i++) s->bpp += tget(&buf, type, s->le);
+ for (i = 0; i < count && buf < end_buf; i++)
+ s->bpp += tget(&buf, type, s->le);
break;
default:
s->bpp = -1;
@@ -437,7 +462,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case TIFF_COMPR:
s->compr = value;
s->predictor = 0;
- switch(s->compr){
+ switch (s->compr) {
case TIFF_RAW:
case TIFF_PACKBITS:
case TIFF_LZW:
@@ -457,48 +482,54 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
#endif
case TIFF_JPEG:
case TIFF_NEWJPEG:
- av_log(s->avctx, AV_LOG_ERROR, "JPEG compression is not supported\n");
+ av_log(s->avctx, AV_LOG_ERROR,
+ "JPEG compression is not supported\n");
return -1;
default:
- av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n", s->compr);
+ av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n",
+ s->compr);
return -1;
}
break;
case TIFF_ROWSPERSTRIP:
if (type == TIFF_LONG && value == UINT_MAX)
value = s->avctx->height;
- if(value < 1){
- av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n");
+ if (value < 1) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Incorrect value of rows per strip\n");
return -1;
}
s->rps = value;
break;
case TIFF_STRIP_OFFS:
- if(count == 1){
+ if (count == 1) {
s->stripdata = NULL;
s->stripoff = value;
- }else
+ } else
s->stripdata = start + off;
s->strips = count;
- if(s->strips == 1) s->rps = s->height;
+ if (s->strips == 1)
+ s->rps = s->height;
s->sot = type;
- if(s->stripdata > end_buf){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (s->stripdata > end_buf) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
break;
case TIFF_STRIP_SIZE:
- if(count == 1){
+ if (count == 1) {
s->stripsizes = NULL;
s->stripsize = value;
s->strips = 1;
- }else{
+ } else {
s->stripsizes = start + off;
}
s->strips = count;
s->sstype = type;
- if(s->stripsizes > end_buf){
- av_log(s->avctx, AV_LOG_ERROR, "Tag referencing position outside the image\n");
+ if (s->stripsizes > end_buf) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Tag referencing position outside the image\n");
return -1;
}
break;
@@ -513,7 +544,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
s->predictor = value;
break;
case TIFF_INVERT:
- switch(value){
+ switch (value) {
case 0:
s->invert = 1;
break;
@@ -524,13 +555,15 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
case 3:
break;
default:
- av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n", value);
+ av_log(s->avctx, AV_LOG_ERROR, "Color mode %d is not supported\n",
+ value);
return -1;
}
break;
case TIFF_FILL_ORDER:
- if(value < 1 || value > 2){
- av_log(s->avctx, AV_LOG_ERROR, "Unknown FillOrder value %d, trying default one\n", value);
+ if (value < 1 || value > 2) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Unknown FillOrder value %d, trying default one\n", value);
value = 1;
}
s->fill_order = value - 1;
@@ -544,44 +577,44 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
gp = buf + count / 3 * off;
bp = buf + count / 3 * off * 2;
off = (type_sizes[type] - 1) << 3;
- for(i = 0; i < count / 3; i++){
+ for (i = 0; i < count / 3; i++) {
j = 0xff << 24;
j |= (tget(&rp, type, s->le) >> off) << 16;
j |= (tget(&gp, type, s->le) >> off) << 8;
- j |= tget(&bp, type, s->le) >> off;
+ j |= tget(&bp, type, s->le) >> off;
pal[i] = j;
}
s->palette_is_set = 1;
break;
case TIFF_PLANAR:
- if(value == 2){
+ if (value == 2) {
av_log(s->avctx, AV_LOG_ERROR, "Planar format is not supported\n");
return -1;
}
break;
case TIFF_T4OPTIONS:
- if(s->compr == TIFF_G3)
+ if (s->compr == TIFF_G3)
s->fax_opts = value;
break;
case TIFF_T6OPTIONS:
- if(s->compr == TIFF_G4)
+ if (s->compr == TIFF_G4)
s->fax_opts = value;
break;
default:
- av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag);
+ av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n",
+ tag, tag);
}
return 0;
}
static int decode_frame(AVCodecContext *avctx,
- void *data, int *data_size,
- AVPacket *avpkt)
+ void *data, int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- TiffContext * const s = avctx->priv_data;
+ TiffContext *const s = avctx->priv_data;
AVFrame *picture = data;
- AVFrame * const p = &s->picture;
+ AVFrame *const p = &s->picture;
const uint8_t *orig_buf = buf, *end_buf = buf + buf_size;
unsigned off;
int id, le, ret;
@@ -593,10 +626,13 @@ static int decode_frame(AVCodecContext *avctx,
//parse image header
if (end_buf - buf < 8)
return AVERROR_INVALIDDATA;
- id = AV_RL16(buf); buf += 2;
- if(id == 0x4949) le = 1;
- else if(id == 0x4D4D) le = 0;
- else{
+ id = AV_RL16(buf);
+ buf += 2;
+ if (id == 0x4949)
+ le = 1;
+ else if (id == 0x4D4D)
+ le = 0;
+ else {
av_log(avctx, AV_LOG_ERROR, "TIFF header not found\n");
return -1;
}
@@ -606,8 +642,9 @@ static int decode_frame(AVCodecContext *avctx,
s->fill_order = 0;
// As TIFF 6.0 specification puts it "An arbitrary but carefully chosen number
// that further identifies the file as a TIFF file"
- if(tget_short(&buf, le) != 42){
- av_log(avctx, AV_LOG_ERROR, "The answer to life, universe and everything is not correct!\n");
+ if (tget_short(&buf, le) != 42) {
+ av_log(avctx, AV_LOG_ERROR,
+ "The answer to life, universe and everything is not correct!\n");
return -1;
}
// Reset these pointers so we can tell if they were set this frame
@@ -620,12 +657,12 @@ static int decode_frame(AVCodecContext *avctx,
}
buf = orig_buf + off;
entries = tget_short(&buf, le);
- for(i = 0; i < entries; i++){
- if(tiff_decode_tag(s, orig_buf, buf, end_buf) < 0)
+ for (i = 0; i < entries; i++) {
+ if (tiff_decode_tag(s, orig_buf, buf, end_buf) < 0)
return -1;
buf += 12;
}
- if(!s->stripdata && !s->stripoff){
+ if (!s->stripdata && !s->stripoff) {
av_log(avctx, AV_LOG_ERROR, "Image data is missing\n");
return -1;
}
@@ -633,36 +670,37 @@ static int decode_frame(AVCodecContext *avctx,
if ((ret = init_image(s)) < 0)
return ret;
- if(s->strips == 1 && !s->stripsize){
+ if (s->strips == 1 && !s->stripsize) {
av_log(avctx, AV_LOG_WARNING, "Image data size missing\n");
s->stripsize = buf_size - s->stripoff;
}
stride = p->linesize[0];
dst = p->data[0];
- for(i = 0; i < s->height; i += s->rps){
- if(s->stripsizes) {
+ for (i = 0; i < s->height; i += s->rps) {
+ if (s->stripsizes) {
if (s->stripsizes >= end_buf)
return AVERROR_INVALIDDATA;
ssize = tget(&s->stripsizes, s->sstype, s->le);
} else
ssize = s->stripsize;
- if(s->stripdata){
+ if (s->stripdata) {
if (s->stripdata >= end_buf)
return AVERROR_INVALIDDATA;
soff = tget(&s->stripdata, s->sot, s->le);
- }else
+ } else
soff = s->stripoff;
if (soff > buf_size || ssize > buf_size - soff) {
av_log(avctx, AV_LOG_ERROR, "Invalid strip size/offset\n");
return -1;
}
- if(tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize, FFMIN(s->rps, s->height - i)) < 0)
+ if (tiff_unpack_strip(s, dst, stride, orig_buf + soff, ssize,
+ FFMIN(s->rps, s->height - i)) < 0)
break;
dst += s->rps * stride;
}
- if(s->predictor == 2){
+ if (s->predictor == 2) {
dst = p->data[0];
soff = s->bpp >> 3;
ssize = s->width * soff;
@@ -681,18 +719,18 @@ static int decode_frame(AVCodecContext *avctx,
dst += stride;
}
} else {
- for(i = 0; i < s->height; i++) {
- for(j = soff; j < ssize; j++)
+ for (i = 0; i < s->height; i++) {
+ for (j = soff; j < ssize; j++)
dst[j] += dst[j - soff];
dst += stride;
}
}
}
- if(s->invert){
+ if (s->invert) {
dst = s->picture.data[0];
- for(i = 0; i < s->height; i++){
- for(j = 0; j < s->picture.linesize[0]; j++)
+ for (i = 0; i < s->height; i++) {
+ for (j = 0; j < s->picture.linesize[0]; j++)
dst[j] = (s->avctx->pix_fmt == PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255) - dst[j];
dst += s->picture.linesize[0];
}
@@ -703,7 +741,8 @@ static int decode_frame(AVCodecContext *avctx,
return buf_size;
}
-static av_cold int tiff_init(AVCodecContext *avctx){
+static av_cold int tiff_init(AVCodecContext *avctx)
+{
TiffContext *s = avctx->priv_data;
s->width = 0;
@@ -719,10 +758,10 @@ static av_cold int tiff_init(AVCodecContext *avctx){
static av_cold int tiff_end(AVCodecContext *avctx)
{
- TiffContext * const s = avctx->priv_data;
+ TiffContext *const s = avctx->priv_data;
ff_lzw_decode_close(&s->lzw);
- if(s->picture.data[0])
+ if (s->picture.data[0])
avctx->release_buffer(avctx, &s->picture);
return 0;
}
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 50c4725045..021ce496ff 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -229,7 +229,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->max_subframe_len_bit = 0;
s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1;
- num_possible_block_sizes = log2_max_num_subframes + 1;
s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes;
s->dynamic_range_compression = s->decode_flags & 0x80;
s->bV3RTM = s->decode_flags & 0x100;
@@ -940,9 +939,10 @@ static int decode_subframe(WmallDecodeCtx *s)
if (rawpcm_tile) {
int bits = s->bits_per_sample - padding_zeroes;
- if (bits <= 0 ) {
- av_log(s->avctx, AV_LOG_ERROR, "rawpcm_tile bits invalid\n");
- return -1;
+ if (bits <= 0) {
+ av_log(s->avctx, AV_LOG_ERROR,
+ "Invalid number of padding bits in raw PCM tile\n");
+ return AVERROR_INVALIDDATA;
}
av_dlog(s->avctx, "RAWPCM %d bits per sample. "
"total %d bits, remain=%d\n", bits,
@@ -1169,8 +1169,7 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
GetBitContext* gb = &s->pgb;
const uint8_t* buf = avpkt->data;
int buf_size = avpkt->size;
- int num_bits_prev_frame, packet_sequence_number,
- seekable_frame_in_packet, spliced_packet;
+ int num_bits_prev_frame, packet_sequence_number, spliced_packet;
if (s->packet_done || s->packet_loss) {
s->packet_done = 0;
@@ -1185,9 +1184,11 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
/* parse packet header */
init_get_bits(gb, buf, s->buf_bit_size);
- packet_sequence_number = get_bits(gb, 4);
- seekable_frame_in_packet = get_bits1(gb);
- spliced_packet = get_bits1(gb);
+ packet_sequence_number = get_bits(gb, 4);
+ skip_bits(gb, 1); // Skip seekable_frame_in_packet, currently ununused
+ spliced_packet = get_bits1(gb);
+ if (spliced_packet)
+ av_log_missing_feature(avctx, "Bitstream splicing", 1);
/* get number of bits that need to be added to the previous frame */
num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm
index 568ad29769..769582c060 100644
--- a/libavcodec/x86/dsputil_yasm.asm
+++ b/libavcodec/x86/dsputil_yasm.asm
@@ -594,7 +594,7 @@ cglobal emu_edge_core, 2, 7, 0
%define valw2 r7w
%define valw3 r3w
%if WIN64
-%define valw4 r4w
+%define valw4 r7w
%else ; unix64
%define valw4 r3w
%endif