* Many thanks to Dan Dennedy <dan@dennedy.org> for providing wealth
* of DV technical info.
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
- * @file libavcodec/dv.c
+ * @file
* DV codec.
*/
#define ALT_BITSTREAM_READER
} else {
iweight1 = &dv_iweight_1080_y[0];
iweight2 = &dv_iweight_1080_c[0];
- }
+ }
if (DV_PROFILE_IS_HD(d)) {
for (c = 0; c < 4; c++) {
for (s = 0; s < 16; s++) {
for (; i < dv_quant_areas[c]; i++) {
*factor1 = iweight1[i] << (dv_quant_shifts[s][c] + 1);
*factor2++ = (*factor1++) << 1;
- }
- }
+ }
+ }
+ }
}
}
}
-}
return 0;
}
int mb_x, mb_y, c_offset, linesize, y_stride;
uint8_t* y_ptr;
uint8_t* dif;
- uint8_t scratch[64];
+ LOCAL_ALIGNED_8(uint8_t, scratch, [64]);
EncBlockInfo enc_blks[5*DV_MAX_BPM];
PutBitContext pbs[5*DV_MAX_BPM];
PutBitContext* pb;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
DVVideoContext *s = avctx->priv_data;
+ const uint8_t* vsc_pack;
+ int apt, is16_9;
s->sys = ff_dv_frame_profile(s->sys, buf, buf_size);
if (!s->sys || buf_size < s->sys->frame_size || dv_init_dynamic_tables(s->sys)) {
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->picture;
+ /* Determine the codec's sample_aspect ratio from the packet */
+ vsc_pack = buf + 80*5 + 48 + 5;
+ if ( *vsc_pack == dv_video_control ) {
+ apt = buf[4] & 0x07;
+ is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || (!apt && (vsc_pack[2] & 0x07) == 0x07)));
+ avctx->sample_aspect_ratio = s->sys->sar[is16_9];
+ }
+
return s->sys->frame_size;
}
#endif /* CONFIG_DVVIDEO_DECODER */
#if CONFIG_DVVIDEO_ENCODER
-AVCodec dvvideo_encoder = {
+AVCodec ff_dvvideo_encoder = {
"dvvideo",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_DVVIDEO,
sizeof(DVVideoContext),
dvvideo_init_encoder,
#endif // CONFIG_DVVIDEO_ENCODER
#if CONFIG_DVVIDEO_DECODER
-AVCodec dvvideo_decoder = {
+AVCodec ff_dvvideo_decoder = {
"dvvideo",
- CODEC_TYPE_VIDEO,
+ AVMEDIA_TYPE_VIDEO,
CODEC_ID_DVVIDEO,
sizeof(DVVideoContext),
dvvideo_init,
dvvideo_decode_frame,
CODEC_CAP_DR1,
NULL,
+ .max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"),
};
#endif