History

Merge remote branch 'qatar/master'

* qatar/master: avio: add more documentation for AVIOContext. Parse sprite data for WMVP and WVP2, and decode sprites for the latter Replace outdated info on the FAQ Redefine sameq pad: fix example explanation gradfun: add notice from the MPlayer manual eval: add support for trunc, ceil, and floor functions documentation: add setdar and setsar description to filters.texi avio: document some members of AVIOContext. avio: document avio_close(). avio: cosmetics, vertically align comments. avio: cosmetics, group the reading functions. avio: cosmetics, merge all the FF_API_OLD_AVIO blocks. avio: cosmetics, move AVIOContext to start of the file. avio: update file header. os: fix OpenBSD/PowerPC compilation pixfmt: add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE oggdec: fix demuxing chained audio streams fix typo Conflicts: doc/filters.texi libavformat/avio.h libavutil/pixfmt.h

Michael Niedermayer committed 15 years ago

Commit ab8cfd42 parents 2e92a34 d1c5fdf10 files · +315 −164Browse files

Showing the changes to libavcodec (4 of 10 files). Show all

Unified · Split

4 files
  1. libavcodec/vc1.c +0 −3
  2. libavcodec/vc1.h +6 −0
  3. libavcodec/vc1dec.c +124 −3
  4. libavcodec/version.h +1 −1
libavcodec/vc1.c+0−3
@@ -605,9 +605,6 @@ int vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) · 604 unmodified lines
605{605{
606 int pqindex, lowquant, status;606 int pqindex, lowquant, status;
607 607
608 if(v->res_sprite) {
609 skip_bits(gb, 2); //not yet deciphered
610 }
611 if(v->finterpflag) v->interpfrm = get_bits1(gb);608 if(v->finterpflag) v->interpfrm = get_bits1(gb);
612 skip_bits(gb, 2); //framecnt unused609 skip_bits(gb, 2); //framecnt unused
613 v->rangeredfrm = 0;610 v->rangeredfrm = 0;
libavcodec/vc1.h+6−0
@@ -306,6 +306,12 @@ typedef struct VC1Context{ · 305 unmodified lines
306 uint8_t range_mapuv;306 uint8_t range_mapuv;
307 //@}307 //@}
308 308
309 /** Frame decoding info for sprite modes */
310 //@{
311 int new_sprite;
312 int two_sprites;
313 //@}
314
309 int p_frame_skipped;315 int p_frame_skipped;
310 int bi_type;316 int bi_type;
311 int x8_type;317 int x8_type;
libavcodec/vc1dec.c+124−3
@@ -3097,6 +3097,116 @@ static void vc1_decode_blocks(VC1Context *v, int mby_start, int mby_end) · 3096 unmodified lines
3097 }3097 }
3098}3098}
3099 3099
3100static inline float get_float_val(GetBitContext* gb)
3101{
3102 return (float)get_bits_long(gb, 30) / (1<<15) - (1<<14);
3103}
3104
3105static void vc1_sprite_parse_transform(VC1Context *v, GetBitContext* gb, float c[7])
3106{
3107 c[1] = c[3] = 0.0f;
3108
3109 switch (get_bits(gb, 2)) {
3110 case 0:
3111 c[0] = 1.0f;
3112 c[2] = get_float_val(gb);
3113 c[4] = 1.0f;
3114 break;
3115 case 1:
3116 c[0] = c[4] = get_float_val(gb);
3117 c[2] = get_float_val(gb);
3118 break;
3119 case 2:
3120 c[0] = get_float_val(gb);
3121 c[2] = get_float_val(gb);
3122 c[4] = get_float_val(gb);
3123 break;
3124 case 3:
3125 av_log_ask_for_sample(v->s.avctx, NULL);
3126 c[0] = get_float_val(gb);
3127 c[1] = get_float_val(gb);
3128 c[2] = get_float_val(gb);
3129 c[3] = get_float_val(gb);
3130 c[4] = get_float_val(gb);
3131 break;
3132 }
3133 c[5] = get_float_val(gb);
3134 if (get_bits1(gb))
3135 c[6] = get_float_val(gb);
3136 else
3137 c[6] = 1.0f;
3138}
3139
3140static void vc1_parse_sprites(VC1Context *v, GetBitContext* gb)
3141{
3142 int effect_type, effect_flag, effect_pcount1, effect_pcount2, i;
3143 float effect_params1[14], effect_params2[10];
3144
3145 float coefs[2][7];
3146 vc1_sprite_parse_transform(v, gb, coefs[0]);
3147 av_log(v->s.avctx, AV_LOG_DEBUG, "S1:");
3148 for (i = 0; i < 7; i++)
3149 av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[0][i]);
3150 av_log(v->s.avctx, AV_LOG_DEBUG, "\n");
3151
3152 if (v->two_sprites) {
3153 vc1_sprite_parse_transform(v, gb, coefs[1]);
3154 av_log(v->s.avctx, AV_LOG_DEBUG, "S2:");
3155 for (i = 0; i < 7; i++)
3156 av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", coefs[1][i]);
3157 av_log(v->s.avctx, AV_LOG_DEBUG, "\n");
3158 }
3159 skip_bits(gb, 2);
3160 if (effect_type = get_bits_long(gb, 30)){
3161 switch (effect_pcount1 = get_bits(gb, 4)) {
3162 case 2:
3163 effect_params1[0] = get_float_val(gb);
3164 effect_params1[1] = get_float_val(gb);
3165 break;
3166 case 7:
3167 vc1_sprite_parse_transform(v, gb, effect_params1);
3168 break;
3169 case 14:
3170 vc1_sprite_parse_transform(v, gb, effect_params1);
3171 vc1_sprite_parse_transform(v, gb, &effect_params1[7]);
3172 break;
3173 default:
3174 av_log_ask_for_sample(v->s.avctx, NULL);
3175 return;
3176 }
3177 if (effect_type != 13 || effect_params1[0] != coefs[0][6]) {
3178 // effect 13 is simple alpha blending and matches the opacity above
3179 av_log(v->s.avctx, AV_LOG_DEBUG, "Effect: %d; params: ", effect_type);
3180 for (i = 0; i < effect_pcount1; i++)
3181 av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params1[i]);
3182 av_log(v->s.avctx, AV_LOG_DEBUG, "\n");
3183 }
3184
3185 effect_pcount2 = get_bits(gb, 16);
3186 if (effect_pcount2 > 10) {
3187 av_log(v->s.avctx, AV_LOG_ERROR, "Too many effect parameters\n");
3188 return;
3189 } else if (effect_pcount2) {
3190 i = 0;
3191 av_log(v->s.avctx, AV_LOG_DEBUG, "Effect params 2: ");
3192 while (i < effect_pcount2){
3193 effect_params2[i] = get_float_val(gb);
3194 av_log(v->s.avctx, AV_LOG_DEBUG, " %.3f", effect_params2[i]);
3195 i++;
3196 }
3197 av_log(v->s.avctx, AV_LOG_DEBUG, "\n");
3198 }
3199 }
3200 if (effect_flag = get_bits1(gb))
3201 av_log(v->s.avctx, AV_LOG_DEBUG, "Effect flag set\n");
3202
3203 if (get_bits_count(gb) >= gb->size_in_bits +
3204 (v->s.avctx->codec_id == CODEC_ID_WMV3 ? 64 : 0))
3205 av_log(v->s.avctx, AV_LOG_ERROR, "Buffer overrun\n");
3206 if (get_bits_count(gb) < gb->size_in_bits - 8)
3207 av_log(v->s.avctx, AV_LOG_WARNING, "Buffer not fully read\n");
3208}
3209
3100/** Initialize a VC1/WMV3 decoder3210/** Initialize a VC1/WMV3 decoder
3101 * @todo TODO: Handle VC-1 IDUs (Transport level?)3211 * @todo TODO: Handle VC-1 IDUs (Transport level?)
3102 * @todo TODO: Decypher remaining bits in extra_data3212 * @todo TODO: Decypher remaining bits in extra_data
@@ -3160,7 +3270,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) · 57 unmodified lines
3160 {3270 {
3161 av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count);3271 av_log(avctx, AV_LOG_INFO, "Read %i bits in overflow\n", -count);
3162 }3272 }
3163 } else { // VC1/WVC13273 } else { // VC1/WVC1/WVP2
3164 const uint8_t *start = avctx->extradata;3274 const uint8_t *start = avctx->extradata;
3165 uint8_t *end = avctx->extradata + avctx->extradata_size;3275 uint8_t *end = avctx->extradata + avctx->extradata_size;
3166 const uint8_t *next;3276 const uint8_t *next;
@@ -3204,6 +3314,7 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) · 37 unmodified lines
3204 av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");3314 av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
3205 return -1;3315 return -1;
3206 }3316 }
3317 v->res_sprite = (avctx->codec_tag == MKTAG('W','V','P','2'));
3207 }3318 }
3208 avctx->profile = v->profile;3319 avctx->profile = v->profile;
3209 if (v->profile == PROFILE_ADVANCED)3320 if (v->profile == PROFILE_ADVANCED)
@@ -3359,6 +3470,14 @@ static int vc1_decode_frame(AVCodecContext *avctx, · 149 unmodified lines
3359 init_get_bits(&s->gb, buf2, buf_size2*8);3470 init_get_bits(&s->gb, buf2, buf_size2*8);
3360 } else3471 } else
3361 init_get_bits(&s->gb, buf, buf_size*8);3472 init_get_bits(&s->gb, buf, buf_size*8);
3473
3474 if (v->res_sprite) {
3475 v->new_sprite = !get_bits1(&s->gb);
3476 v->two_sprites = get_bits1(&s->gb);
3477 if (!v->new_sprite)
3478 goto end;
3479 }
3480
3362 // do parse frame header3481 // do parse frame header
3363 if(v->profile < PROFILE_ADVANCED) {3482 if(v->profile < PROFILE_ADVANCED) {
3364 if(vc1_parse_frame_header(v, &s->gb) == -1) {3483 if(vc1_parse_frame_header(v, &s->gb) == -1) {
@@ -3370,8 +3489,8 @@ static int vc1_decode_frame(AVCodecContext *avctx, · 5 unmodified lines
3370 }3489 }
3371 }3490 }
3372 3491
3373 if(v->res_sprite && (s->pict_type!=FF_I_TYPE)){3492 if (v->res_sprite && s->pict_type!=FF_I_TYPE) {
3374 goto err;3493 av_log(v->s.avctx, AV_LOG_WARNING, "Sprite decoder: expected I-frame\n");
3375 }3494 }
3376 3495
3377 s->current_picture_ptr->repeat_pict = 0;3496 s->current_picture_ptr->repeat_pict = 0;
@@ -3464,6 +3583,8 @@ assert(s->current_picture.pict_type == s->pict_type); · 86 unmodified lines
3464 }3583 }
3465 3584
3466end:3585end:
3586 if (v->res_sprite)
3587 vc1_parse_sprites(v, &s->gb);
3467 av_free(buf2);3588 av_free(buf2);
3468 for (i = 0; i < n_slices; i++)3589 for (i = 0; i < n_slices; i++)
3469 av_free(slices[i].buf);3590 av_free(slices[i].buf);
libavcodec/version.h+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5223#define LIBAVCODEC_VERSION_MAJOR 52
24#define LIBAVCODEC_VERSION_MINOR 11724#define LIBAVCODEC_VERSION_MINOR 117
25#define LIBAVCODEC_VERSION_MICRO 025#define LIBAVCODEC_VERSION_MICRO 1
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
28 LIBAVCODEC_VERSION_MINOR, \28 LIBAVCODEC_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t