Re: [libav-devel] Indeo 4 B-frames
Am 08.06.2014 14:15, schrieb Dirk Ausserhaus: On Sun, Jun 8, 2014 at 2:10 PM, Kostya Shishkov wrote: On Sun, Jun 08, 2014 at 01:53:49PM +0200, Dirk Ausserhaus wrote: Here's a patch that fixes decoding of Indeo 4 B-frames. Looks correct. I should've done it long time ago and saved you some work. Now the main problem is Indeo 4 B-frames reconstruction. For that I need to modify IVI context to store the second pair of vectors (that is not hard at all) and make it perform the averaging motion compensation for B-blocks (that one seems to require some more hacking). It seems tricker than most codecs since in Indeo one does not add residue to motion compensation but rather the othe way around so motion function will have to do averaging inside before adding result to the block. IIRC, it performs a simple averaging motion compensation like this: (X + Y) / 2. IIRC, it doesn't even do a proper rounding. The tricky part was which frames to choose - two different kinds of NULL frames (type 6 and 7) play the key role there. I'll try to search my data for more information on this topic. Not sure how sucessful it will be because alot of time has passed since I worked on this codec... Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/2] Go2Meeting decoder
Am 07.03.2014 15:31, schrieb Diego Biurrun: From: Maxim Poliakovski JPEG part decoding and minor improvements for ePIC decoder by Kostya Shishkov. Signed-off-by: Diego Biurrun --- IMHO the code has been shipped abit too soon - there are several issues with it I'm currently working on. For the start, memory usage can be improved at several places. Moreover, this would improve robustness against malformed data. I've just fixed a bug preventing several samples from being decoded properly. My suggestion is to incorporate the above mentioned improvements first. I'd do that and will resubmit the patch. Ok? Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] g2meet: Validate bpp and bitmasks in the display info
--- libavcodec/g2meet.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 045c2a5..e5edc04 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -653,7 +653,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, GetByteContext bc, tbc; int magic; int got_header = 0; -uint32_t chunk_size; +uint32_t chunk_size, r_mask, g_mask, b_mask; int chunk_type, chunk_start; int i; int ret; @@ -728,6 +728,27 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, c->tiles_x = (c->width + c->tile_width - 1) / c->tile_width; c->tiles_y = (c->height + c->tile_height - 1) / c->tile_height; c->bpp = bytestream2_get_byte(&bc); +if (c->bpp == 32) { +if (bytestream2_get_bytes_left(&bc) < 16 || +(chunk_size - 21) < 16 ) { +av_log(avctx, AV_LOG_ERROR, + "Display info: missing bitmasks!\n"); +return AVERROR_INVALIDDATA; +} +r_mask = bytestream2_get_be32(&bc); +g_mask = bytestream2_get_be32(&bc); +b_mask = bytestream2_get_be32(&bc); +if (r_mask != 0xFF || g_mask != 0xFF00 || b_mask != 0xFF) { +av_log(avctx, AV_LOG_ERROR, + "Invalid or unsupported bitmasks: R=%X, G=%X, B=%X\n", + r_mask, g_mask, b_mask); +return AVERROR_PATCHWELCOME; +} +} else { +av_log(avctx, AV_LOG_ERROR, + "Unsupported bpp=%d in the display info!\n", c->bpp); +return AVERROR_PATCHWELCOME; +} if (g2m_init_buffers(c)) { ret = AVERROR(ENOMEM); goto header_fail; -- 1.7.9.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/5] g2meet: rename FRAME_INFO to more appropriate DISPLAY_INFO
Signed-off-by: Kostya Shishkov --- libavcodec/g2meet.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index 0b36dbd..9ce56c9 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -35,7 +35,7 @@ #include "mjpeg.h" enum ChunkType { -FRAME_INFO = 0xC8, +DISPLAY_INFO = 0xC8, TILE_DATA, CURSOR_POS, CURSOR_SHAPE, @@ -679,10 +679,10 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, break; } switch (chunk_type) { -case FRAME_INFO: +case DISPLAY_INFO: c->got_header = 0; if (chunk_size < 21) { -av_log(avctx, AV_LOG_ERROR, "Invalid frame info size %d\n", +av_log(avctx, AV_LOG_ERROR, "Invalid display info size %d\n", chunk_size); break; } @@ -729,7 +729,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data, case TILE_DATA: if (!c->tiles_x || !c->tiles_y) { av_log(avctx, AV_LOG_WARNING, - "No frame header - skipping tile\n"); + "No display info - skipping tile\n"); bytestream2_skip(&bc, bytestream2_get_bytes_left(&bc)); break; } -- 1.7.9.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add ATRAC3+ decoder, 4th try
Am 03.01.2014 16:57, schrieb Justin Ruggles: On 01/02/2014 03:41 PM, Maxim Polijakowski wrote: +static int atrac3p_decode_frame(AVCodecContext *avctx, void *data, +int *got_frame_ptr, AVPacket *avpkt) +{ +ATRAC3PContext *ctx = avctx->priv_data; +AVFrame *frame = data; +int i, ret, ch_unit_id, ch_block = 0, out_ch_index = 0, channels_to_process; +float **samples_p = (float **)frame->extended_data; + +frame->nb_samples = ATRAC3P_FRAME_SAMPLES; +if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { +av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); +return ret; +} + +if ((ret = init_get_bits8(&ctx->gb, avpkt->data, avpkt->size)) < 0) +return ret; + +if (get_bits1(&ctx->gb)) { +av_log(avctx, AV_LOG_ERROR, "Invalid start bit!\n"); +return AVERROR_INVALIDDATA; +} + +while (get_bits_left(&ctx->gb) >= 2 && + (ch_unit_id = get_bits(&ctx->gb, 2)) != CH_UNIT_TERMINATOR) { +if (ch_unit_id == CH_UNIT_EXTENSION) { +avpriv_report_missing_feature(avctx, "Channel unit extension"); +return AVERROR_PATCHWELCOME; +} +if (ch_block >= ctx->num_channel_blocks || +ctx->channel_blocks[ch_block] != ch_unit_id) { +av_log(avctx, AV_LOG_ERROR, + "Frame data doesn't match channel configuration!\n"); +return AVERROR_INVALIDDATA; +} + +ctx->ch_units[ch_block].unit_type = ch_unit_id; +channels_to_process = ch_unit_id + 1; + +if ((ret = ff_atrac3p_decode_channel_unit(&ctx->gb, + &ctx->ch_units[ch_block], + channels_to_process, + avctx)) < 0) +return ret; + + decode_residual_spectrum(&ctx->ch_units[ch_block], ctx->samples, + channels_to_process, avctx); +reconstruct_frame(ctx, &ctx->ch_units[ch_block], + channels_to_process, avctx); + +for (i = 0; i < channels_to_process; i++) +memcpy(samples_p[out_ch_index + i], ctx->outp_buf[i], + ATRAC3P_FRAME_SAMPLES * sizeof(**samples_p)); + +ch_block++; +out_ch_index += channels_to_process; +} + +*got_frame_ptr = 1; + +return avctx->block_align; +} We need to be careful here with how multiple frames-per-packet are handled. Do you know when that occurs and when it does not occur? What containers can ATRAC3+ be in, and do all of them set block_align? Currently, ATRAC3+ streams are known to be shipped either within Sony's OMA or RIFF WAV containers. These demuxers seem to set block_align appropriately. PSMF container used with PlayStation can supply ATRAC3+ tracks as well but Libav doesn't currently support PSMF. We at least need a check to ensure that block_align is non-zero, otherwise it can lead to an infinite loop. We fixed a similar issue recently with WMA. OK, a check for non-zero block align sounds indeed like a good idea to me. Nevertheless, zero block-align doesn't make any sense and would indicate a broken media file... Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ATRAC3+ decoder, 2nd try
Am 19.10.2013 13:57, schrieb Luca Barbato: On 19/10/13 13:49, Maxim Polijakowski wrote: Am 19.10.2013 01:45, schrieb Luca Barbato: On 19/10/13 00:37, Maxim Polijakowski wrote: --> VLC tables have been made static. There is no dynamic allocation and deallocation anymore To initialize static data you might use the init_static_data callback, the rest seems ok to go to me. IIRC, init_static_data is called form avcodec_register(), is it? Then it would allocate and initialize >600k memory without be sure ATRAC3+ decoder will be ever used! Fix me if I'm wrong here... The tables are static so will be there anyway or I'm missing something? No, you're right - the tables memory is already there but it's uninitialized first. Please keep in mind that we're about to initialize >600k of memory at avcodec_register(), i.e. at startup. I don't know how fast the code is - moreover, I spent zero time to optimize it, so running it always in background will slow down the startup process by an unknown amount of time. Another question: how many codecs actually use this feature? To my knowledge there is only a few: atrac3, jpeg2000, x264 and TAK. That part can be fixed later by adding lazy loading (and that involves adding a lock in the avcodec structure). Lazy loading? What is it? Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] ATRAC3+ decoder, 2nd try
Am 19.10.2013 01:45, schrieb Luca Barbato: On 19/10/13 00:37, Maxim Polijakowski wrote: --> VLC tables have been made static. There is no dynamic allocation and deallocation anymore To initialize static data you might use the init_static_data callback, the rest seems ok to go to me. IIRC, init_static_data is called form avcodec_register(), is it? Then it would allocate and initialize >600k memory without be sure ATRAC3+ decoder will be ever used! Fix me if I'm wrong here... Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add ATRAC3+ decoder
Thank you for your suggestions! Please find the updated patch in my next email [PATCH] ATRAC3+ decoder, 2nd try Below a couple of comments... On Thu, Oct 10, 2013 at 9:14 PM, Maxim Polijakowski wrote: Hi crews, the attached patch adds an open-source decoder for Sony's ATRAC3+ format. There is a partial description of its internals located here: http://wiki.multimedia.cx/**index.php?title=ATRAC3plus<http://wiki.multimedia.cx/index.php?title=ATRAC3plus> You could define: const uint8_t *ff_atrac3p_sf_huff_bits[] = {atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits2, atrac3p_sf_huff_bits1, ...}; And use one (or three) loops to init it (also valid for the ones initialized with build_canonical_huff). This part has been significantly reworked. The VLC initialization uses more loops now... +static void subtract_sf_weights(Atrac3pChanUnitCtx *ctx, +Atrac3pChanParams *chan, int wtab_idx) +{ +int i; +const int8_t *weights_tab; + +weights_tab = &ff_atrac3p_sf_weights[wtab_idx - 1][0]; + +for (i = 0; i < ctx->used_quant_units; i++) +chan->qu_sf_idx[i] -= weights_tab[i]; +} Please move this function right after add_wordlen_weights(). Even if I understand the reason for the code duplication, I think grouping them together improves readability. Done. There is a pretty large number of decode_* functions with four different coding modes, some more or less similar. In the cases where applicable, It would be nice to have some comments like: /** * This function almost identical to decode_something_else(), but VLC delta coding use * different coefficients. */ Ok, comments will be added/improved later... +/** + * ATRAC3+ uses two different MDCT windows: + * - The first one is just the plain sine window of size 256. + * - The 2nd one is the plain sine window of size 128 + * wrapped into zero (at the start) and one (at the end) regions. + * Both regions are 32 samples long. */ +static float mdct_wind_steep[128]; ///< second MDCT window + +av_cold void ff_atrac3p_init_imdct(AVCodecContext *avctx, FFTContext *mdct_ctx) +{ +int i; + +avpriv_float_dsp_init(&atrac3p_dsp, avctx->flags & CODEC_FLAG_BITEXACT); + +ff_init_ff_sine_windows(7); +ff_init_ff_sine_windows(6); + +/* Copy the 2nd sine window and place it between one/zero regions. */ +memcpy(&mdct_wind_steep[32], ff_sine_64, sizeof(ff_sine_64)); + +for (i = 0; i < 32; i++) { +mdct_wind_steep[i] = 0.0f; +mdct_wind_steep[127 - i] = 1.0f; +} I think you could use ff_sine_64 directly if you modify ff_atrac3p_imdct() doing something like atrac3p_dsp.vector_fmul(pOut+64, pOut+64, ff_sine_64, 64); for the steep window case. Done. + +/* generate amplitude mantissas table */ +for (i = 0; i < 16; i++) +amp_mant_tab[i] = (1.0f / 15.13f) * (i + 1); +} + I think this can be done efficiently without a table. Indeed. The table has been replaced with direct computation. +/* Hann windowing for non-faded wave signals */ +if (tones_now->num_wavs && tones_next->num_wavs && +reg1_env_nonzero && reg2_env_nonzero) { +for (i = 0; i < 128; i++) { +wavreg1[i] *= hann_window[128 - i]; +wavreg2[i] *= hann_window[i]; +} +} else { +if (tones_now->num_wavs && !tones_now->curr_env.has_stop_point) +for (i = 0; i < 128; i++) +wavreg1[i] *= hann_window[128 - i]; + +if (tones_next->num_wavs && !tones_next->curr_env.has_start_point) +for (i = 0; i < 128; i++) +wavreg2[i] *= hann_window[i]; +} + +/* Overlap and add to residual */ +for (i = 0; i < 128; i++) +out[i] += wavreg1[i] + wavreg2[i]; +} I think we have DSP functions for multiplying and adding floats. Yes, replaced with vector_fmul()... +void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist, + float *in, float *out) +{ +int i, s, sb, t, pos_now, pos_next; +DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS]; +DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS]; + +memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out)); + +for (s = 0; s < ATRAC3P_SUBBAND_SAMPLES; s++) { +/* pick up one sample from each subband */ +for (sb = 0; sb < ATRAC3P_SUBBANDS; sb++) +idct_in[sb] = in[sb * ATRAC3P_SUBBAND_SAMPLES + s]; + +/* Calculate the sine and cosine part of the PQF using IDCT-IV */ +dct_ctx->imdct_half(dct_ctx, idct_out, idct_in); IDCT-IV or IMDCT? imdct_half = IDCT-IV in this case because there is no overlap... Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Add ATRAC3+ decoder
Thank you for your suggestions! Please find the updated patch in my next email [PATCH] ATRAC3+ decoder, 2nd try Below a couple of comments... +/** + * Generate canonical VLC table from given descriptor. + * + * @param[in] cb ptr to codebook descriptor + * @param[in] xlat ptr to translation table or NULL + * @param[out] out_vlc ptr to vlc table to be generated + */ +static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t *xlat, + VLC *out_vlc) +{ +int i, b; +uint16_t codes[256]; +uint8_t bits[256]; +unsigned code = 0; +int index = 0; +int min_len = *cb++; // get shortest codeword length +int max_len = *cb++; // get longest codeword length + +for (b = min_len; b <= max_len; b++) { +for (i = *cb++; i > 0; i--) { +bits[index] = b; +codes[index] = code++; +index++; +} +code <<= 1; +} + +ff_init_vlc_sparse(out_vlc, max_len, index, bits, 1, 1, codes, 2, 2, + xlat, 1, 1, 0); IIRC building VLC might fail (and not only because of wrong codes but also because of allocation error), so it should be checked. All VLC tables have been made static, thus there will be no allocation failure in this context anymore... [...] useless checks - ff_free_vlc() will work on empty VLCs fine too Static VLC tables don't require ff_free_vlc() anymore... [...] + +/** + * Decode word length for each quantization unit of a channel. + * + * @param[in,out] ctx ptr to the decoder context + * @param[in] num_channels number of channels to process + * @param[in] avctx ptr to the AVCodecContext + * @return result code: 0 = OK, -1 = error + */ +static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, + int ch_num, ATRAC3PVlcTabs *vlc_tabs, + AVCodecContext *avctx) +{ +int i, weight_idx = 0, delta, diff, pos, delta_bits, min_val, flag, ret; +VLC *vlc_tab; +Atrac3pChanParams *chan = &ctx->channels[ch_num]; +Atrac3pChanParams *ref_chan = &ctx->channels[0]; + +chan->fill_mode = 0; + +switch (get_bits(gb, 2)) { /* switch according to coding mode */ +case 0: /* coded using constant number of bits */ +for (i = 0; i < ctx->num_quant_units; i++) +chan->qu_wordlen[i] = get_bits(gb, 3); +break; +case 1: +if (ch_num) { +if ((ret = num_coded_units(gb, chan, ctx, avctx)) < 0) +return ret; + +if (chan->num_coded_vals) { +vlc_tab = &vlc_tabs->wl_vlc_tabs[get_bits(gb, 2)]; + +for (i = 0; i < chan->num_coded_vals; i++) { +delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); probably we can test for delta < 0 here (i.e. a bitstream error) It looks like I need to check each call to get_vlc2() for errors and that will mess up the code. Is there really any case where it may return a negative value? [...] +} + +if (chan->fill_mode == 2) { +for (i = chan->num_coded_vals; i < ctx->num_quant_units; i++) +chan->qu_wordlen[i] = ch_num ? get_bits1(gb) : 1; I'd simply memset it and then chan->qu_wordlen[ch_num] = get_bits1(gb); (if it's in range of course) Memset would require to convert chan->qu_wordlen (currently int) to uint8_t and that would be neither significantly faster (because we'are processing just few elements) nor shorter. Fix me if I'm wrong... + +/** + * Decode scale factor indexes for each quant unit of a channel. + * + * @param[in,out] ctx ptr to the decoder context + * @param[in] num_channels number of channels to process + * @param[in] avctx ptr to the AVCodecContext + * @return result code: 0 = OK, -1 = error + */ +static int decode_channel_sf_idx(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, + int ch_num, ATRAC3PVlcTabs *vlc_tabs, + AVCodecContext *avctx) +{ +int i, weight_idx, delta, diff, num_long_vals, +delta_bits, min_val, vlc_sel; +VLC *vlc_tab; +Atrac3pChanParams *chan = &ctx->channels[ch_num]; +Atrac3pChanParams *ref_chan = &ctx->channels[0]; + +switch (get_bits(gb, 2)) { /* switch according to coding mode */ +case 0: /* coded using constant number of bits */ +for (i = 0; i < ctx->used_quant_units; i++) +chan->qu_sf_idx[i] = get_bits(gb, 6); +break; +case 1: +if (ch_num) { +vlc_tab = &vlc_tabs->sf_vlc_tabs[get_bits(gb, 2)]; + +for (i = 0; i < ctx->used_quant_units; i++) { +delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); +chan->qu_sf_idx[i] = (ref_chan->qu_sf_idx[i] + delta) & 0x3F; +} +} else { +weight_idx = get_bits(gb, 2); +if (weight_idx == 3) { +
[libav-devel] [PATCH] More Atrac3 cleanups
@subject Best regards Maxim >From f3367f63e06ab0161671fedc907b8445877b48d2 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Thu, 10 Oct 2013 09:59:03 +0200 Subject: [PATCH 1/2] atrac3: Remove unused gain compensation tables Patch by Diego Biurrun. --- libavcodec/atrac3.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 5378d95..8380c17 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -114,9 +114,6 @@ typedef struct ATRAC3Context { static DECLARE_ALIGNED(32, float, mdct_window)[MDCT_SIZE]; static VLC_TYPE atrac3_vlc_table[4096][2]; static VLC spectral_coeff_tab[7]; -static float gain_tab1[16]; -static float gain_tab2[31]; - /** * Regular 512 points IMDCT without overlapping, with the exception of the @@ -792,13 +789,6 @@ static av_cold void atrac3_init_static_data(AVCodec *codec) huff_bits[i], 1, 1, huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); } - -/* Generate gain tables */ -for (i = 0; i < 16; i++) -gain_tab1[i] = powf(2.0, (4 - i)); - -for (i = -15; i < 16; i++) -gain_tab2[i + 15] = powf(2.0, i * -0.125); } static av_cold int atrac3_decode_init(AVCodecContext *avctx) -- 1.7.9.5 >From cc8ad57a70895115de22f2500f52fdaab2cd5579 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Thu, 10 Oct 2013 10:07:24 +0200 Subject: [PATCH 2/2] atrac3: Better name for imdct window initialization Patch by Diego Biurrun. --- libavcodec/atrac3.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 8380c17..76fd0d1 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -170,7 +170,7 @@ static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes) return off; } -static av_cold void init_atrac3_window(void) +static av_cold void init_imdct_window(void) { int i, j; @@ -777,7 +777,7 @@ static av_cold void atrac3_init_static_data(AVCodec *codec) { int i; -init_atrac3_window(); +init_imdct_window(); ff_atrac_generate_tables(); /* Initialize the VLC tables. */ -- 1.7.9.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Atrac: add missing av_cold
@topic Best regards Maxim >From 8b49fdf6d775ef658f474c5126108c5bb05d695e Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Thu, 3 Oct 2013 20:49:50 +0200 Subject: [PATCH] atrac: Add missing av_cold --- libavcodec/atrac.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 0f57215..f36db9e 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -45,7 +45,7 @@ static const float qmf_48tap_half[24] = { -0.043596379, -0.099384367, 0.13207909,0.46424159 }; -void ff_atrac_generate_tables(void) +av_cold void ff_atrac_generate_tables(void) { int i; float s; -- 1.7.9.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Generalize ATRAC3 gain compensation code
[...] And I'm helping you by doing all the postprocessing on ATRAC3+ :) Thank you for that once again! I could do all the work myself directly, but I choose to review your patches so that in the future the postprocessing work is reduced while you adapt a bit more to the modern libav style and workflow. If we get to that point, things will go much more smoothly. Alright. I'll fix up and split/rebase this patchset later today. The most things you pointed out in your last mail have just been fixed (see my previous mail). Hopefully there is not much left to fix so you could push the patches soon. Thanks in advance! Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Generalize ATRAC3 gain compensation code
[...] --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -66,20 +62,8 @@ void ff_atrac_generate_tables(void) -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp) +void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, +float *delayBuf, float *temp) slightly unrelated cosmetics Also, K&R does not leave a space between the function name and the opening (. It's not my code but I've fixed that anyway... [...] --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -28,6 +28,26 @@ +typedef struct AtracGainInfo { +int num_points; ///< number of gain control points +int levcode[7]; ///< level at corresponding control point +int loccode[7]; ///< location of gain control points +} AtracGainInfo; Why is there "code" in these names and not "point" or "points"? Because codes don't represent levels or locations directly and need to be scaled appropriately as follows: location = loccode * 8; level = pow(2, levcode - codec_specific_offset); See attached patch... Best regards Maxim >From f82fde4838c6472a88dafc03a6522679c19df4e2 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 23:14:51 +0200 Subject: [PATCH 1/2] atrac: Move doxygen comments to the header Also update copyright info and file description. --- libavcodec/atrac.c | 24 libavcodec/atrac.h | 23 +++ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 6041a12..de2f131 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -1,6 +1,6 @@ /* - * ATRAC common functions - * Copyright (c) 2006-2008 Maxim Poliakovski + * Common functions for the ATRAC family of decoders + * Copyright (c) 2006-2013 Maxim Poliakovski * Copyright (c) 2006-2008 Benjamin Larsson * * This file is part of Libav. @@ -44,10 +44,6 @@ static const float qmf_48tap_half[24] = { -0.043596379, -0.099384367, 0.13207909,0.46424159 }; -/** - * Generate common tables - */ - void ff_atrac_generate_tables(void) { int i; @@ -66,20 +62,8 @@ void ff_atrac_generate_tables(void) } } - -/** - * Quadrature mirror synthesis filter. - * - * @param inlo lower part of spectrum - * @param inhi higher part of spectrum - * @param nIn size of spectrum buffer - * @param pOut out buffer - * @param delayBuf delayBuf buffer - * @param temp temp buffer - */ - - -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp) +void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, +float *delayBuf, float *temp) { int i, j; float *p1, *p3; diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index 8e9ba59..6067f18 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -1,7 +1,7 @@ /* - * ATRAC common data - * Copyright (c) 2009 Maxim Poliakovski - * Copyright (c) 2009 Benjamin Larsson + * Common functions for the ATRAC family of decoders + * Copyright (c) 2009-2013 Maxim Poliakovski + * Copyright (c) 2009 Benjamin Larsson * * This file is part of Libav. * @@ -30,7 +30,22 @@ extern float ff_atrac_sf_table[64]; +/** + * Generate common tables. + */ void ff_atrac_generate_tables(void); -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp); + +/** + * Quadrature mirror synthesis filter. + * + * @param inlo lower part of spectrum + * @param inhi higher part of spectrum + * @param nIn size of spectrum buffer + * @param pOut out buffer + * @param delayBuf delayBuf buffer + * @param temp temp buffer + */ +void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, +float *delayBuf, float *temp); #endif /* AVCODEC_ATRAC_H */ -- 1.7.9.5 >From f605b3261fef9ca886776ef6ef5c75d05273d46d Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 23:14:51 +0200 Subject: [PATCH 2/2] atrac3: Generalize gain compensation code Move it to atrac.c, so it can be reused within the upcoming ATRAC3+ decoder. --- libavcodec/atrac.c | 65 +++- libavcodec/atrac.h | 49 +++- libavcodec/atrac3.c | 103 ++- 3 files changed, 130 insertions(+), 87 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index de2f131..7469237 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -62,8 +62,69 @@ void ff_atrac_generate_tables(void) } } -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, -float *delayBuf, float *temp) +av_cold void ff_atrac_init_gain_compensation(AtracGCContext *gctx, int id2exp_offset, +
Re: [libav-devel] [PATCH] Generalize ATRAC3 gain compensation code
[...] --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -417,90 +412,32 @@ static int decode_tonal_components(GetBitContext *gb, static int decode_gain_control(GetBitContext *gb, GainBlock *block, int num_bands) { -int i, cf, num_data; +int i, b; int *level, *loc; -for (i = 0; i <= num_bands; i++) { -num_data = get_bits(gb, 3); -gain[i].num_gain_data = num_data; -level = gain[i].lev_code; -loc = gain[i].loc_code; +for (b = 0; b <= num_bands; b++) { +gain[b].num_points = get_bits(gb, 3); +level = gain[b].levcode; +loc= gain[b].loccode; -for (cf = 0; cf < gain[i].num_gain_data; cf++) { -level[cf] = get_bits(gb, 4); -loc [cf] = get_bits(gb, 5); -if (cf && loc[cf] <= loc[cf - 1]) +for (i = 0; i < gain[b].num_points; i++) { +level[i] = get_bits(gb, 4); +loc [i] = get_bits(gb, 5); +if (i && loc[i] <= loc[i-1]) return AVERROR_INVALIDDATA; } } -/* Clear the unused blocks. */ -for (; i < 4 ; i++) -gain[i].num_gain_data = 0; +/* Clear unused blocks. */ +for (; b < 4 ; b++) +gain[b].num_points = 0; Is there a reason to rename the counter variables? It seems rather arbitrary and complicates the diff. Yes, the reason for rename this variable is to make it look more "standard" and readable. What does that "cf" stand for? "Core Foundation" or "close file"? "i" is unambiguous and clear, isn't it? The above mentioned changes look rather trivial IMHO so I wonder if someone else could fix them all and push the patches. Taking in consideration the amount of work I'm currently doing in order to provide Libav with support for several other obscured and proprietary formats, fixing such things again and again wastes alot of my time and keep me away from doing perhaps more important stuff. Thanks in advance! Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] Generalize ATRAC3 gain compensation code
@Derek && @Diego: Thank you for the review! Please find attached the updated patch. Best regards Maxim >From 085cfcbfeada7736c54406573e5fe2c56ab11016 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 23:14:51 +0200 Subject: [PATCH 1/2] atrac cosmetics: move doxygen comments to the header file, break long lines, improve file description and update copyright messages. --- libavcodec/atrac.c | 24 libavcodec/atrac.h | 23 +++ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 6041a12..de2f131 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -1,6 +1,6 @@ /* - * ATRAC common functions - * Copyright (c) 2006-2008 Maxim Poliakovski + * Common functions for the ATRAC family of decoders + * Copyright (c) 2006-2013 Maxim Poliakovski * Copyright (c) 2006-2008 Benjamin Larsson * * This file is part of Libav. @@ -44,10 +44,6 @@ static const float qmf_48tap_half[24] = { -0.043596379, -0.099384367, 0.13207909,0.46424159 }; -/** - * Generate common tables - */ - void ff_atrac_generate_tables(void) { int i; @@ -66,20 +62,8 @@ void ff_atrac_generate_tables(void) } } - -/** - * Quadrature mirror synthesis filter. - * - * @param inlo lower part of spectrum - * @param inhi higher part of spectrum - * @param nIn size of spectrum buffer - * @param pOut out buffer - * @param delayBuf delayBuf buffer - * @param temp temp buffer - */ - - -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp) +void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, +float *delayBuf, float *temp) { int i, j; float *p1, *p3; diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index 8e9ba59..6067f18 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -1,7 +1,7 @@ /* - * ATRAC common data - * Copyright (c) 2009 Maxim Poliakovski - * Copyright (c) 2009 Benjamin Larsson + * Common functions for the ATRAC family of decoders + * Copyright (c) 2009-2013 Maxim Poliakovski + * Copyright (c) 2009 Benjamin Larsson * * This file is part of Libav. * @@ -30,7 +30,22 @@ extern float ff_atrac_sf_table[64]; +/** + * Generate common tables. + */ void ff_atrac_generate_tables(void); -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp); + +/** + * Quadrature mirror synthesis filter. + * + * @param inlo lower part of spectrum + * @param inhi higher part of spectrum + * @param nIn size of spectrum buffer + * @param pOut out buffer + * @param delayBuf delayBuf buffer + * @param temp temp buffer + */ +void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, +float *delayBuf, float *temp); #endif /* AVCODEC_ATRAC_H */ -- 1.7.9.5 >From aade9868608a65231a57dd36f203a647a9db906b Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Tue, 1 Oct 2013 00:58:41 +0200 Subject: [PATCH 2/2] atrac3: Generalize gain compensation code Move it to atrac.c, so it can be reused within the upcoming ATRAC3+ decoder. --- libavcodec/atrac.c | 60 ++ libavcodec/atrac.h | 45 ++ libavcodec/atrac3.c | 103 ++- 3 files changed, 125 insertions(+), 83 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index de2f131..59e4c0e 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -62,6 +62,66 @@ void ff_atrac_generate_tables(void) } } +av_cold void ff_atrac_init_gain_compensation(AtracGCContext *gctx, int id2exp_offset, + int loc_scale) +{ +int i; + +gctx->loc_scale = loc_scale; +gctx->loc_size = 1 << loc_scale; +gctx->id2exp_offset = id2exp_offset; + +/* Generate gain level table. */ +for (i = 0; i < 16; i++) +gctx->gain_tab1[i] = powf(2.0, id2exp_offset - i); + +/* Generate gain interpolation table. */ +for (i = -15; i < 16; i++) +gctx->gain_tab2[i + 15] = powf(2.0, -1.0f / gctx->loc_size * i); +} + +void ff_atrac_gain_compensation(AtracGCContext *gctx, float *in, float *prev, +AtracGainInfo *gc_now, AtracGainInfo *gc_next, +int num_samples, float *out) +{ +float lev, gc_scale, gain_inc; +int i, pos, lastpos; + +gc_scale = gc_next->num_points ? gctx->gain_tab1[gc_next->levcode[0]] : 1.0f; + +if (!gc_now->num_points) { +for (pos = 0; pos < num_samples; pos++) +out[pos] = in[pos] * gc_scale + prev[pos]; +} else { +pos = 0; + +for (i = 0; i < gc_now->num_points; i++) { +lastpos = gc_now->loccode[i] <&l
[libav-devel] [PATCH] Generalize ATRAC3 gain compensation code
Hi crews, the attached patch set delivers a generalized version of the ATRAC3 gain compensation code so it can be reused in the upcoming ATRAC3+ decoder without reinventing the wheel. Moreover, a minor cleanup (improving descriptions and doxygen comments) has been made as well. Please review and commit. Best regards Maxim >From 7a850f8fc070436b20a5adee496fe81466d821d2 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 14:00:18 +0200 Subject: [PATCH 1/3] Move doxygen comments to the header file. --- libavcodec/atrac.c | 15 --- libavcodec/atrac.h | 16 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 6041a12..04f7b1a 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -44,9 +44,6 @@ static const float qmf_48tap_half[24] = { -0.043596379, -0.099384367, 0.13207909,0.46424159 }; -/** - * Generate common tables - */ void ff_atrac_generate_tables(void) { @@ -67,18 +64,6 @@ void ff_atrac_generate_tables(void) } -/** - * Quadrature mirror synthesis filter. - * - * @param inlo lower part of spectrum - * @param inhi higher part of spectrum - * @param nIn size of spectrum buffer - * @param pOut out buffer - * @param delayBuf delayBuf buffer - * @param temp temp buffer - */ - - void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp) { int i, j; diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index 8e9ba59..1691119 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -30,7 +30,23 @@ extern float ff_atrac_sf_table[64]; + +/** + * Generate common tables. + */ void ff_atrac_generate_tables(void); + + +/** + * Quadrature mirror synthesis filter. + * + * @param inlo lower part of spectrum + * @param inhi higher part of spectrum + * @param nIn size of spectrum buffer + * @param pOut out buffer + * @param delayBuf delayBuf buffer + * @param temp temp buffer + */ void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp); #endif /* AVCODEC_ATRAC_H */ -- 1.7.9.5 >From 4161d2be843edf4bc409fc42b6cb5974c2eeed39 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 14:04:43 +0200 Subject: [PATCH 2/3] Improve file description and actualize the copyright messages. --- libavcodec/atrac.c |4 ++-- libavcodec/atrac.h |6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 04f7b1a..71b2f71 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -1,6 +1,6 @@ /* - * ATRAC common functions - * Copyright (c) 2006-2008 Maxim Poliakovski + * Common functions for the ATRAC family of decoders + * Copyright (c) 2006-2013 Maxim Poliakovski * Copyright (c) 2006-2008 Benjamin Larsson * * This file is part of Libav. diff --git a/libavcodec/atrac.h b/libavcodec/atrac.h index 1691119..da3500d 100644 --- a/libavcodec/atrac.h +++ b/libavcodec/atrac.h @@ -1,7 +1,7 @@ /* - * ATRAC common data - * Copyright (c) 2009 Maxim Poliakovski - * Copyright (c) 2009 Benjamin Larsson + * Common functions for the ATRAC family of decoders + * Copyright (c) 2009-2013 Maxim Poliakovski + * Copyright (c) 2009 Benjamin Larsson * * This file is part of Libav. * -- 1.7.9.5 >From b8db1f2eb215ca20fad0783c63742cac9ea1fbda Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Mon, 30 Sep 2013 14:27:31 +0200 Subject: [PATCH 3/3] Generalize ATRAC3 gain compensation code and move it to atrac.c so it can be reused within ATRAC3+ decoder. --- libavcodec/atrac.c | 64 - libavcodec/atrac.h | 51 ++- libavcodec/atrac3.c | 97 +-- 3 files changed, 130 insertions(+), 82 deletions(-) diff --git a/libavcodec/atrac.c b/libavcodec/atrac.c index 71b2f71..947b878 100644 --- a/libavcodec/atrac.c +++ b/libavcodec/atrac.c @@ -64,7 +64,69 @@ void ff_atrac_generate_tables(void) } -void ff_atrac_iqmf (float *inlo, float *inhi, unsigned int nIn, float *pOut, float *delayBuf, float *temp) +void ff_atrac_init_gain_compensation(GCContext *gctx, int id2exp_offset, int loc_scale) +{ +int i; + +gctx->loc_scale = loc_scale; +gctx->loc_size = 1 << loc_scale; +gctx->id2exp_offset = id2exp_offset; + +/* Generate gain level table. */ +for (i = 0; i < 16; i++) +gctx->gain_tab1[i] = powf(2.0, (id2exp_offset - i)); + +/* Generate gain interpolation table. */ +for (i = -15; i < 16; i++) +gctx->gain_tab2[i + 15] = powf(2.0, i * (-1.0f / gctx->loc_size)); +} + + +void ff_atrac_gain_compensation(GCContext *gctx, float *in, float *prev, +GainInfo *gc_now, GainInfo *gc_next, +int num
Re: [libav-devel] [PATCH] Add support for multichannel ATRAC3+ to OpenMG demuxer
Hi crews, the attached patch adds support for multichannel ATRAC3+ streams to the OpenMG demuxer. It also sets the currently wrong ATRAC3+ frame size to right one of 2048 samples. The patch for ATRAC3+ codec itself is in preparation and will be posted shortly... Please find attached the updated patch... Best regards Maxim >From cb20dd04f8ba8342dc2992df4287b55df3b2175c Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Sat, 28 Sep 2013 00:18:18 +0200 Subject: [PATCH] Add support for multichannel ATRAC3+ streams. --- libavformat/oma.c| 15 +++ libavformat/oma.h|3 +++ libavformat/omadec.c | 15 +++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/libavformat/oma.c b/libavformat/oma.c index aaaf0b2..27b5988 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -21,6 +21,7 @@ #include "internal.h" #include "oma.h" #include "libavcodec/avcodec.h" +#include "libavutil/channel_layout.h" const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; @@ -31,3 +32,17 @@ const AVCodecTag ff_oma_codec_tags[] = { { AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM}, { 0 }, }; + +/** map ATRAC-X channel id to internal channel layout */ +const uint64_t ff_oma_chid_to_native_layout[7] = { +AV_CH_LAYOUT_MONO, +AV_CH_LAYOUT_STEREO, +AV_CH_LAYOUT_SURROUND, +AV_CH_LAYOUT_4POINT0, +AV_CH_LAYOUT_5POINT1_BACK, +AV_CH_LAYOUT_6POINT1_BACK, +AV_CH_LAYOUT_7POINT1 +}; + +/** map ATRAC-X channel id to total number of channels */ +const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; diff --git a/libavformat/oma.h b/libavformat/oma.h index 1f0ddf9..9a35da2 100644 --- a/libavformat/oma.h +++ b/libavformat/oma.h @@ -41,4 +41,7 @@ extern const uint16_t ff_oma_srate_tab[8]; extern const AVCodecTag ff_oma_codec_tags[]; +extern const uint64_t ff_oma_chid_to_native_layout[7]; +extern const int ff_oma_chid_to_num_channels[7]; + #endif /* AVFORMAT_OMA_H */ diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 274112e..e5a2090 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -1,7 +1,7 @@ /* * Sony OpenMG (OMA) demuxer * - * Copyright (c) 2008 Maxim Poliakovski + * Copyright (c) 2008, 2013 Maxim Poliakovski * 2008 Benjamin Larsson * 2011 David Goldwich * @@ -284,7 +284,7 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header) static int oma_read_header(AVFormatContext *s) { int ret, framesize, jsflag, samplerate; -uint32_t codec_params; +uint32_t codec_params, channel_id; int16_t eid; uint8_t buf[EA3_HEADER_SIZE]; uint8_t *edata; @@ -364,7 +364,14 @@ static int oma_read_header(AVFormatContext *s) avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); break; case OMA_CODECID_ATRAC3P: -st->codec->channels = (codec_params >> 10) & 7; +channel_id = (codec_params >> 10) & 7; +if (!channel_id) { +av_log(s, AV_LOG_ERROR, + "Invalid ATRAC-X channel id: %d\n", channel_id); +return AVERROR_INVALIDDATA; +} +st->codec->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1]; +st->codec->channels = ff_oma_chid_to_num_channels[channel_id - 1]; framesize = ((codec_params & 0x3FF) * 8) + 8; samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) { @@ -372,7 +379,7 @@ static int oma_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codec->sample_rate = samplerate; -st->codec->bit_rate= samplerate * framesize * 8 / 1024; +st->codec->bit_rate= samplerate * framesize * 8 / 2048; avpriv_set_pts_info(st, 64, 1, samplerate); av_log(s, AV_LOG_ERROR, "Unsupported codec ATRAC3+!\n"); break; -- 1.7.9.5 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] Add support for multichannel ATRAC3+ to OpenMG demuxer
Hi crews, the attached patch adds support for multichannel ATRAC3+ streams to the OpenMG demuxer. It also sets the currently wrong ATRAC3+ frame size to right one of 2048 samples. The patch for ATRAC3+ codec itself is in preparation and will be posted shortly... Please review and commit. Best regards Maxim diff --git a/libavformat/oma.c b/libavformat/oma.c index aaaf0b2..99d46fd 100644 --- a/libavformat/oma.c +++ b/libavformat/oma.c @@ -21,6 +21,7 @@ #include "internal.h" #include "oma.h" #include "libavcodec/avcodec.h" +#include "libavutil/channel_layout.h" const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; @@ -31,3 +32,17 @@ const AVCodecTag ff_oma_codec_tags[] = { { AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM}, { 0 }, }; + +/** map ATRAC-X channel ID to internal channel layout */ +const uint64_t ff_oma_chid_to_native_layout[7] = { +AV_CH_LAYOUT_MONO, +AV_CH_LAYOUT_STEREO, +AV_CH_LAYOUT_SURROUND, +AV_CH_LAYOUT_4POINT0, +AV_CH_LAYOUT_5POINT1_BACK, +AV_CH_LAYOUT_6POINT1_BACK, +AV_CH_LAYOUT_7POINT1 +}; + +/** map ATRAC-X channel ID to total number of channels */ +const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; diff --git a/libavformat/oma.h b/libavformat/oma.h index 1f0ddf9..9a35da2 100644 --- a/libavformat/oma.h +++ b/libavformat/oma.h @@ -41,4 +41,7 @@ extern const uint16_t ff_oma_srate_tab[8]; extern const AVCodecTag ff_oma_codec_tags[]; +extern const uint64_t ff_oma_chid_to_native_layout[7]; +extern const int ff_oma_chid_to_num_channels[7]; + #endif /* AVFORMAT_OMA_H */ diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 274112e..aa0fd95 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -1,7 +1,7 @@ /* * Sony OpenMG (OMA) demuxer * - * Copyright (c) 2008 Maxim Poliakovski + * Copyright (c) 2008, 2013 Maxim Poliakovski * 2008 Benjamin Larsson * 2011 David Goldwich * @@ -37,7 +37,7 @@ * - Sound data organized in packets follow the EA3 header * (can be encrypted using the Sony DRM!). * - * CODEC SUPPORT: Only ATRAC3 codec is currently supported! + * Supported CODECs: ATRAC3, ATRAC3+, MP3, LPCM */ #include "libavutil/channel_layout.h" @@ -284,7 +284,7 @@ static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header) static int oma_read_header(AVFormatContext *s) { int ret, framesize, jsflag, samplerate; -uint32_t codec_params; +uint32_t codec_params, channel_id; int16_t eid; uint8_t buf[EA3_HEADER_SIZE]; uint8_t *edata; @@ -364,7 +364,13 @@ static int oma_read_header(AVFormatContext *s) avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); break; case OMA_CODECID_ATRAC3P: -st->codec->channels = (codec_params >> 10) & 7; +channel_id = (codec_params >> 10) & 7; +if (!channel_id) { +av_log(s, AV_LOG_ERROR, "Invalid ATRAC-X channel id: %d\n", channel_id); +return AVERROR_INVALIDDATA; +} +st->codec->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1]; +st->codec->channels = ff_oma_chid_to_num_channels[channel_id - 1]; framesize = ((codec_params & 0x3FF) * 8) + 8; samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) { @@ -372,7 +378,7 @@ static int oma_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } st->codec->sample_rate = samplerate; -st->codec->bit_rate= samplerate * framesize * 8 / 1024; +st->codec->bit_rate= samplerate * framesize * 8 / 2048; avpriv_set_pts_info(st, 64, 1, samplerate); av_log(s, AV_LOG_ERROR, "Unsupported codec ATRAC3+!\n"); break; ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/2] Intel Media SDK, Quick Sync Video/QSV: Initial add of H.264 decoder infrastructure
From: Maxym Dmytrychenko --- Changelog |1 + configure |7 +++ libavcodec/Makefile|2 ++ libavcodec/allcodecs.c |1 + libavcodec/qsv.h |2 +- libavcodec/qsv_h264.c |9 - libavcodec/version.h |2 +- libavutil/pixfmt.h |1 + 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Changelog b/Changelog index f56c112..765b87f 100644 --- a/Changelog +++ b/Changelog @@ -4,6 +4,7 @@ releases are sorted from youngest to oldest. version 10: - av_strnstr - support ID3v2 tags in ASF files +- QSV decoder hardware acceleration version 9: diff --git a/configure b/configure index 1aae93b..dcd0c37 100755 --- a/configure +++ b/configure @@ -130,6 +130,7 @@ Component options: Hardware accelerators: --enable-dxva2 enable DXVA2 code + --enable-qsv enable QSV code --enable-vaapi enable VAAPI code --enable-vda enable VDA code --enable-vdpau enable VDPAU code @@ -1048,6 +1049,7 @@ EXTERNAL_LIBRARY_LIST=" HWACCEL_LIST=" dxva2 +qsv vaapi vda vdpau @@ -1624,6 +1626,8 @@ zmbv_encoder_select="zlib" # hardware accelerators dxva2_deps="dxva2api_h" +qsv_deps="mfx_mfxvideo_h" +qsv_extralibs="-lmfx -lstdc++" vaapi_deps="va_va_h" vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore" @@ -1635,6 +1639,8 @@ h263_vdpau_hwaccel_deps="vdpau" h263_vdpau_hwaccel_select="h263_decoder" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" +h264_qsv_decoder_deps="qsv" +h264_qsv_decoder_select="h264_decoder" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" h264_vda_hwaccel_deps="vda" @@ -3468,6 +3474,7 @@ check_header sys/resource.h check_header sys/select.h check_header sys/time.h check_header unistd.h +check_header mfx/mfxvideo.h check_header vdpau/vdpau.h check_header vdpau/vdpau_x11.h check_header VideoDecodeAcceleration/VDADecoder.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 262d2eb..d0b6166 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -5,6 +5,7 @@ HEADERS = avcodec.h \ avfft.h \ dxva2.h \ old_codec_ids.h \ + qsv.h \ vaapi.h \ vda.h \ vdpau.h \ @@ -199,6 +200,7 @@ OBJS-$(CONFIG_H264_DECODER)+= h264.o \ cabac.o h264_sei.o h264_ps.o \ h264_refs.o h264_cavlc.o h264_cabac.o OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o +OBJS-$(CONFIG_H264_QSV_DECODER)+= qsv.o qsv_h264.o OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o OBJS-$(CONFIG_H264_VDA_HWACCEL)+= vda_h264.o OBJS-$(CONFIG_H264_VDPAU_HWACCEL) += vdpau_h264.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 8bfa603..a4f8643 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -150,6 +150,7 @@ void avcodec_register_all(void) REGISTER_DECODER(H263I, h263i); REGISTER_ENCODER(H263P, h263p); REGISTER_DECODER(H264, h264); +REGISTER_DECODER(H264_QSV, h264_qsv); REGISTER_DECODER(H264_VDPAU,h264_vdpau); REGISTER_ENCDEC (HUFFYUV, huffyuv); REGISTER_DECODER(IDCIN, idcin); diff --git a/libavcodec/qsv.h b/libavcodec/qsv.h index cfbf75c..fc16fea 100644 --- a/libavcodec/qsv.h +++ b/libavcodec/qsv.h @@ -335,7 +335,7 @@ typedef struct av_qsv_config { /** * Distance between I- or P- key frames; if it is zero, the GOP structure is unspecified. - * Note: If GopRefDist = 1, there are no B-frames used. + * Note: If GopRefDist = 1 no B-frames are used. * * - encoding: Set by user. * - decoding: unused diff --git a/libavcodec/qsv_h264.c b/libavcodec/qsv_h264.c index fbd3aa7..51122c2 100644 --- a/libavcodec/qsv_h264.c +++ b/libavcodec/qsv_h264.c @@ -267,8 +267,8 @@ int ff_qsv_decode_init(AVCodecContext *avctx) "Using default config for QSV decode\n"); avctx->hwaccel_context = &av_qsv_default_config; } else { -if ((*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_OPAQUE_MEMORY -&& (*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_SYSTEM_MEMORY) { +if ((*qsv_config_context)->io_pattern != MFX_IOPATTERN_OUT_OPAQUE_
Re: [libav-devel] [PATCH 3/4] indeo4/5: remove constant parameter num_bands from wavelet recomposition
Am 10.10.2012 19:57, schrieb Janne Grunau: > Fixes bogus uninitialized value compiler and coverity warnings. > --- > libavcodec/ivi_common.c | 4 ++-- > libavcodec/ivi_dsp.c| 5 +++-- > libavcodec/ivi_dsp.h| 6 ++ > 3 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c > index d1a86c4..d48014c 100644 > --- a/libavcodec/ivi_common.c > +++ b/libavcodec/ivi_common.c > @@ -808,9 +808,9 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void > *data, int *data_size, > > if (ctx->is_scalable) { > if (avctx->codec_id == AV_CODEC_ID_INDEO4) > -ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], > ctx->frame.linesize[0], 4); > +ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], > ctx->frame.linesize[0]); > else > -ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], > ctx->frame.linesize[0], 4); > +ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], > ctx->frame.linesize[0]); > } else { > ff_ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], > ctx->frame.linesize[0]); > } It would be nice to add a description why "num_bands" has been set to that fixed value. The original routines support partial recomposition if one or several bands are not available for whatever reason (insufficient processor power or corrupted frame data). Therefore, the caller could tell the wavelet transform how much bands are available using this parameter. Libav's implementation does currently support neither any processor speed measurements nor any bitstream data recovery. Therefore, this last parameter is practically useless in that implementation. But, IMHO, it should be well documented at least... Thanks Best regards Maxim P. (the author of the original indeo45 code) ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] indeo3: check per-plane data buffer against input buffer bounds.
Am 29.11.2011 05:24, schrieb Ronald S. Bultje: > Hi, > > On Mon, Nov 28, 2011 at 12:58 PM, Aneesh Dogra wrote: >> Fixes: http://bugzilla.libav.org/show_bug.cgi?id=102 >> --- >> libavcodec/indeo3.c |2 ++ >> 1 files changed, 2 insertions(+), 0 deletions(-) >> >> diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c >> index 1d8f694..596cd27 100644 >> --- a/libavcodec/indeo3.c >> +++ b/libavcodec/indeo3.c >> @@ -804,6 +804,8 @@ static int decode_plane(Indeo3DecodeContext *ctx, >> AVCodecContext *avctx, >> num_vectors = bytestream_get_le32(&data); >> ctx->mc_vectors = num_vectors ? data : 0; >> >> +if (num_vectors * 2 >= data_size) >> +return AVERROR_INVALIDDATA; >> /* init the bitreader */ >> init_get_bits(&ctx->gb, &data[num_vectors * 2], data_size << 3); >> ctx->skip_bits = 0; > This leads to the question whether data_size << 3 is really the proper > size for this buffer. In reality, it's (data_size - num_vectors * 2) > << 3. > > Fixing this will allow doing things like get_bits_left() further down > in the stack to prevent more subtle buffer overreads. Yes. That's absolutely correct. A proper fix would be very appreciated! Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] Concurrent ProRes decoder
Hi crews, Yes, it's no mistake! What you see is just another code implementing ProRes decoder. Now I'm going to explain that confusion. Writing a ProRes compatible decoder began as team project in 2010. During this period, I created an internal documentation on the coding algorithm (entropy coding, slicing and inverse transform); a part of this doc has been published at http://wiki.multimedia.cx/index.php?title=Apple_ProRes&action=history already in 2010 (see my nickname "Maxpol" for a proof), but not to much to avoid an implementation by someone else. Later I wrote a working decoder. Due to the lack for interlaced frames it was incomplete, but it could handle the most of samples available. Further I shared my docs and code with another developer, whose name I don't want to mention here. He wrote his own code, heavily based on my work. The team suffered from poor communication and political intrigues... A few days ago that other developer has submitted his decoder anonymously. I feel that the code, containing a significant part of my work, was released without proper credit. Therefore I decided to post my code as well (without any parts written by the other guy though). Hereby I claim copyright on several parts of the ProRes decoder (vlc, headers and slice decoding), because due to my hard work it has reached its final form. My code may be of particular interest because of: - compatible license (LGPL) - a full description of the codec (especially its headers and encoding algorithms) I'm going to make publicitly available soon - maintainership by a real person instead of an anonymous one Therefore I let you, crews, to make a final decision about all that... Best regards Maxim Poliakovski /* * Apple ProRes compatible decoder * * Copyright (c) 2010-2011 Maxim Poliakovski * * This file is part of FFmpeg. * * FFmpeg 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, * 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 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file libavcodec/proresdec.c * This is a decoder for Apple ProRes 422 SD/HQ/LT/Proxy and ProRes . * It is used for storing and editing high definition video data in Apple's Final Cut Pro. * For a detailed description click here: http://wiki.multimedia.cx/index.php?title=Apple_ProRes */ #define A32_BITSTREAM_READER // some ProRes vlc codes require up to 28 bits to be read at once #include "avcodec.h" #include "get_bits.h" #include "dsputil.h" #include "libavutil/mathematics.h" #define BITS_PER_SAMPLE 10 ///< output precision of that decoder #define BIAS (1 << (BITS_PER_SAMPLE - 1)) ///< bias value for converting signed pixels into unsigned ones #define CLIP_MIN (1 << (BITS_PER_SAMPLE - 8)) ///< minimum value for clipping resulting pixels #define CLIP_MAX (1 << BITS_PER_SAMPLE) - CLIP_MIN - 1 ///< maximum value for clipping resulting pixels typedef struct { DSPContext dsp; AVFramepicture; ScanTable scantable; intscantable_type; ///< -1 = uninitialized, 0 = progressive, 1/2 = interlaced intframe_type; ///< 0 = progressive, 1 = top-field first, 2 = bottom-field first intpic_format; ///< 2 = 422, 3 = 444 uint8_tqmat_luma[64]; ///< dequantization matrix for luma uint8_tqmat_chroma[64]; ///< dequantization matrix for chroma intqmat_changed;///< 1 - global quantization matrices changed intprev_slice_sf; ///< scalefactor of the previous decoded slice DECLARE_ALIGNED(16, int16_t, qmat_luma_scaled[64]); DECLARE_ALIGNED(16, int16_t, qmat_chroma_scaled[64]); inttotal_slices;///< total number of slices in a picture const uint8_t **slice_data_index; ///< array of pointers to the data of each slice intchroma_factor; intmb_chroma_factor; intnum_chroma_blocks; ///< number of chrominance blocks in a macroblock intnum_x_slices; intnum_y_slices; intslice_width_factor; intslice_height_factor; intnum_x_mbs; intnum_y_mbs; } ProresContext; static const uint8_t progressive_scan[64] = { 0, 1, 8, 9, 2, 3, 10, 11, 16, 17, 24, 25, 18, 19, 26, 27, 4, 5, 12, 20, 13, 6, 7, 14,
Re: [libav-devel] [PATCH] 10-bit DNxHD support v7
Am 18.07.2011 18:11, schrieb Måns Rullgård: > "Ronald S. Bultje" writes: > > >> Hi, >> >> On Mon, Jul 18, 2011 at 8:33 AM, Joseph Artsimovich >> wrote: >> >>> On 18/07/2011 16:29, Kostya wrote: >>> >>>> On Mon, Jul 18, 2011 at 04:20:14PM +0100, Joseph Artsimovich wrote: >>>> >>>>> On 18/07/2011 16:01, Kostya wrote: >>>>> >>>>>> On Mon, Jul 18, 2011 at 03:56:42PM +0100, Joseph Artsimovich wrote: >>>>>> >>>>>>> On 18/07/2011 15:45, Måns Rullgård wrote: >>>>>>> >>>>>>>> Maximwrites: >>>>>>>> >>>>>>>>> Am 18.07.2011 16:09, schrieb Måns Rullgård: >>>>>>>>> >>>>>>>>>> [...] >>>>>>>>>> >>>>>>>>>>> An integer implementation is surely much faster than floating-point >>>>>>>>>>> one but it's still insufficient for realtime applications >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> The point? >>>>>>>>>> >>>>>>>>>> >>>>>>>>> You'll be able to obtain reasonable performance benefits only by >>>>>>>>> using >>>>>>>>> SIMD-optimized code. That's the point. >>>>>>>>> >>>>>>>> I fail to see how that justifies using the even slower floating-point >>>>>>>> non-simd code. >>>>>>>> >>>>>>>> >>>>>>> I used that as a starting point, thinking it's the only option I had. >>>>>>> Today I tried making various integer-based (I)DCT implementations >>>>>>> work with 10-bit samples. I had success with >>>>>>> ff_jpeg_fdct_islow() by setting BITS_IN_JSAMPLE to 10 and turning my >>>>>>> unsigned samples into signed ones. The latter was required because: >>>>>>> [0 .. 1023] samples -> [0 -> 8191] DCT coeffs -> [0 -> 65528] >>>>>>> after >>>>>>> post-scaling by 8, which is outside of DCTELEM (16 bit signed) >>>>>>> range. With signed samples, I get: >>>>>>> [-512 .. 511] samples -> [-4096 .. 4095] DCT coefs -> [-32768 .. >>>>>>> 32760] after post-scaling by 8, which barely fits in. >>>>>>> >>>>>>> I still had no success with fdct_ifast() or j_rev_dct() though. >>>>>>> >>>>>> change intermediate sample type into 32-bit integers too >>>>>> >>>>> Do you mean DCTELEM? >>>>> >>>> Only for the cases _inside_ DCT transform, input and output should stay >>>> DCTELEM. Look at libavcodec/binkidct.c for example (not the best one >>>> though). >>>> >>> DCTELEM being 16-bit + 8 times post-scaling is already enough to make you go >>> to signed samples for 10-bit and makes it impossible to go higher than that. >>> >> The idea is (see h264) to make DCTELEM 32-bits for 10-bits. >> > Is this necessary? What is the precision of the transformed values? > I saw the figure 14 bits mentioned a while ago, and that should still > fit in 16 bits. Intermediate values in the transform will of course > need to be 32-bit. > > My research regarding Apple's ProRes codec (just another one requires 10bit DCT) resulted in the following precision: IDCT input: signed 13/14-bit output: unsigned 10-bit Worst pmse: 0.0948 Overall mse: 0.0834 Worst mean: 0.0335 This precision could be obtained by roughly 4 digits after the decimal point. To my personal opinion the result (after rounding and clipping) doesn't need to be 32-bit... I have no information regarding to DNxHD's DCT. What does its spec say? Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] 10-bit DNxHD support v7
Am 18.07.2011 16:09, schrieb Måns Rullgård: > [...] > >> An integer implementation is surely much faster than floating-point >> one but it's still insufficient for realtime applications >> > The point? > You'll be able to obtain reasonable performance benefits only by using SIMD-optimized code. That's the point. At this moment I'm able to play back some HD footage (220 Mbps) on my multi-cored PowerPC (+ 8600 rpm HDD) at full framerate without jerking and stuttering only when the optimized DCT is on. Otherwise, only the slow offline conversion will help... IIRC the DNxHD was designed for post-production needs including fast editing. Waiting for conversion would make that codec of a limited usability IMHO... > [snip] > >> - making all that stuff work properly with 14bit input --> 10bit output >> isn't easy at all because it's impossible to obtain the same precision >> as for 8bit. Consider the fact we're manipulating 16bit data words we >> only had 2 digits after the decimal point. It's insufficient. Therefore >> some tricky rounding/upscale steps should be introduced between the >> transform stages >> > The 8-bit code already uses 32-bit intermediates, which is more than > sufficient for 10-bit as well. > I agree with the fact we need at least an integer 10bit IDCT. I'll see what I can do... Best regards Maxim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] 10-bit DNxHD support v7
Am 18.07.2011 14:10, schrieb Måns Rullgård: > [...] > Why are you using the incredibly slow floating-point dct anyway? It > can't be that hard to extend one of the integer ones to 10-bit. It > shouldn't take more than updating the coefficients and some shift > values. > Unfortunately such a task isn't trivial and requires alot of work IMHO because: - there is no implementation for such a transform around the web one can use as reference (or I couldn't find any). Sidenote: the most DCT-related stuff in dsputil was adopted from existing implementations - dsputil doesn't contain any 10bit DCT code. One need to submit such a routine. An integer implementation is surely much faster than floating-point one but it's still insufficient for realtime applications - the only solution is to write SIMD code for at least three main CPUs: x86, PPC, ARM. Note that all those routines work differently with different precision optimized for 12bit input --> 8bit output - making all that stuff work properly with 14bit input --> 10bit output isn't easy at all because it's impossible to obtain the same precision as for 8bit. Consider the fact we're manipulating 16bit data words we only had 2 digits after the decimal point. It's insufficient. Therefore some tricky rounding/upscale steps should be introduced between the transform stages - in the case of a CPU there is no SIMD code for dsputil should fall back to the default integer implementation as indicated above I was able to update the existing Altivec code (ppc/idct_altivec.c) to support 10bit and would submit a patch if someone cares. Unfortunately I don't have any solution for x86 etc. Best regards Maxim P. ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [QUESTION] Proper handling and reporting of decoding errors
Hi crews, I would gladly understand how FFmpeg/libav handles decoding errors. I need that information in order to implement proper error handling in my indeo decoders. case 1: my decoder encounters a broken P-frame. That usually means that all following frames until the next key one will be broken as well. The proper reaction would be to wait for the key frame. What kind of signal does the calling library expect in this case? Error code/empty frame? Should I introduce some kind "need_resync" flag in the decoder and skip broken frames internally or is there any possibility to report broken frames to the caller? case 2: indeo codecs uses sometimes so-called "sync"-frames. The frame data just contain a short header (16 bytes) indicating that nothing has changed. I guess that feature or hack was introduced in order to enable variable frame rate which isn't otherwise provided in the AVI container. Returning previous frame and reporting number of consumed bytes should be fine in that case, shouldn't it? Would it introduce duplicated frames? case 3: temporal scalability. Indeo serie of codecs uses a special kind of P-frames whose can be easily dropped without damaging the whole video sequence. What kind of signal will be send to decoder in order to request frame dropping? The "avctx->hurry_up" flag I used in the previous version of my indeo3 decoder is deprecated meanwhile... Thanks in advance Best regards Maxim Poliakovski ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel