diff options
Diffstat (limited to 'libavcodec/dv.c')
-rw-r--r-- | libavcodec/dv.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/libavcodec/dv.c b/libavcodec/dv.c index 16be0ed..4ea3099 100644 --- a/libavcodec/dv.c +++ b/libavcodec/dv.c @@ -16,20 +16,20 @@ * Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth * of DV technical info. * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * 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. * - * Libav is distributed in the hope that it will be useful, + * 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 Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -311,7 +311,13 @@ av_cold int ff_dvvideo_init(AVCodecContext *avctx) /* 248DCT setup */ s->fdct[1] = dsp.fdct248; s->idct_put[1] = ff_simple_idct248_put; // FIXME: need to add it to DSP - memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); + if (avctx->lowres){ + for (i = 0; i < 64; i++){ + int j = ff_zigzag248_direct[i]; + s->dv_zigzag[1][i] = dsp.idct_permutation[(j & 7) + (j & 8) * 4 + (j & 48) / 2]; + } + }else + memcpy(s->dv_zigzag[1], ff_zigzag248_direct, 64); avctx->coded_frame = &s->picture; s->avctx = avctx; @@ -329,6 +335,10 @@ static av_cold int dvvideo_init_encoder(AVCodecContext *avctx) ff_dv_print_profiles(avctx, AV_LOG_ERROR); return AVERROR(EINVAL); } + if (avctx->height > 576) { + av_log(avctx, AV_LOG_ERROR, "DVCPRO HD encoding is not supported.\n"); + return AVERROR_PATCHWELCOME; + } dv_vlc_map_tableinit(); @@ -501,7 +511,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i method suggested in SMPTE 314M Table 22, and an improved method. The SMPTE method is very conservative; it assigns class 3 (i.e. severe quantization) to any block where the largest AC - component is greater than 36. Libav's DV encoder tracks AC bit + component is greater than 36. FFmpeg's DV encoder tracks AC bit consumption precisely, so there is no need to bias most blocks towards strongly lossy compression. Instead, we assign class 2 to most blocks, and use class 3 only when strictly necessary @@ -509,7 +519,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i #if 0 /* SMPTE spec method */ static const int classes[] = {12, 24, 36, 0xffff}; -#else /* improved Libav method */ +#else /* improved FFmpeg method */ static const int classes[] = {-1, -1, 255, 0xffff}; #endif int max = classes[0]; @@ -952,10 +962,8 @@ static int dvvideo_encode_frame(AVCodecContext *c, AVPacket *pkt, s->sys = avpriv_dv_codec_profile(c); if (!s->sys || ff_dv_init_dynamic_tables(s->sys)) return -1; - if ((ret = ff_alloc_packet(pkt, s->sys->frame_size)) < 0) { - av_log(c, AV_LOG_ERROR, "Error getting output packet.\n"); + if ((ret = ff_alloc_packet2(c, pkt, s->sys->frame_size)) < 0) return ret; - } c->pix_fmt = s->sys->pix_fmt; s->picture = *frame; |