Originally committed as revision 19648 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.6
| @@ -59,9 +59,8 @@ unsigned int ff_dirac_schro_get_video_format_idx (AVCodecContext *avccontext) | |||||
| avccontext->height == vf->height){ | avccontext->height == vf->height){ | ||||
| ret_idx = idx; | ret_idx = idx; | ||||
| if (avccontext->time_base.den == vf->frame_rate_num && | if (avccontext->time_base.den == vf->frame_rate_num && | ||||
| avccontext->time_base.num == vf->frame_rate_denom) { | |||||
| avccontext->time_base.num == vf->frame_rate_denom) | |||||
| return idx; | return idx; | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| return ret_idx; | return ret_idx; | ||||
| @@ -76,9 +75,8 @@ void ff_dirac_schro_queue_init (FfmpegDiracSchroQueue *queue) | |||||
| void ff_dirac_schro_queue_free (FfmpegDiracSchroQueue *queue, | void ff_dirac_schro_queue_free (FfmpegDiracSchroQueue *queue, | ||||
| void (*free_func)(void *)) | void (*free_func)(void *)) | ||||
| { | { | ||||
| while (queue->p_head) { | |||||
| while (queue->p_head) | |||||
| free_func( ff_dirac_schro_queue_pop(queue) ); | free_func( ff_dirac_schro_queue_pop(queue) ); | ||||
| } | |||||
| } | } | ||||
| int ff_dirac_schro_queue_push_back (FfmpegDiracSchroQueue *queue, void *p_data) | int ff_dirac_schro_queue_push_back (FfmpegDiracSchroQueue *queue, void *p_data) | ||||
| @@ -55,11 +55,9 @@ static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt) | |||||
| sizeof(ffmpeg_dirac_pixel_format_map[0]); | sizeof(ffmpeg_dirac_pixel_format_map[0]); | ||||
| int idx; | int idx; | ||||
| for (idx = 0; idx < num_formats; ++idx) { | |||||
| if (ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt) { | |||||
| for (idx = 0; idx < num_formats; ++idx) | |||||
| if (ffmpeg_dirac_pixel_format_map[idx].dirac_pix_fmt == dirac_pix_fmt) | |||||
| return ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt; | return ffmpeg_dirac_pixel_format_map[idx].ff_pix_fmt; | ||||
| } | |||||
| } | |||||
| return PIX_FMT_NONE; | return PIX_FMT_NONE; | ||||
| } | } | ||||
| @@ -188,25 +188,22 @@ static av_cold int libdirac_encode_init(AVCodecContext *avccontext) | |||||
| avccontext->global_quality / (FF_QP2LAMBDA*10.0); | avccontext->global_quality / (FF_QP2LAMBDA*10.0); | ||||
| /* if it is not default bitrate then send target rate. */ | /* if it is not default bitrate then send target rate. */ | ||||
| if (avccontext->bit_rate >= 1000 && | if (avccontext->bit_rate >= 1000 && | ||||
| avccontext->bit_rate != 200000) { | |||||
| avccontext->bit_rate != 200000) | |||||
| p_dirac_params->enc_ctx.enc_params.trate = | p_dirac_params->enc_ctx.enc_params.trate = | ||||
| avccontext->bit_rate / 1000; | avccontext->bit_rate / 1000; | ||||
| } | |||||
| } else | } else | ||||
| p_dirac_params->enc_ctx.enc_params.lossless = 1; | p_dirac_params->enc_ctx.enc_params.lossless = 1; | ||||
| } else if (avccontext->bit_rate >= 1000) | } else if (avccontext->bit_rate >= 1000) | ||||
| p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000; | p_dirac_params->enc_ctx.enc_params.trate = avccontext->bit_rate / 1000; | ||||
| if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) && | if ((preset > VIDEO_FORMAT_QCIF || preset < VIDEO_FORMAT_QSIF525) && | ||||
| avccontext->bit_rate == 200000) { | |||||
| avccontext->bit_rate == 200000) | |||||
| p_dirac_params->enc_ctx.enc_params.trate = 0; | p_dirac_params->enc_ctx.enc_params.trate = 0; | ||||
| } | |||||
| if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) { | |||||
| if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) | |||||
| /* all material can be coded as interlaced or progressive | /* all material can be coded as interlaced or progressive | ||||
| * irrespective of the type of source material */ | * irrespective of the type of source material */ | ||||
| p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1; | p_dirac_params->enc_ctx.enc_params.picture_coding_mode = 1; | ||||
| } | |||||
| p_dirac_params->p_encoder = dirac_encoder_init (&(p_dirac_params->enc_ctx), | p_dirac_params->p_encoder = dirac_encoder_init (&(p_dirac_params->enc_ctx), | ||||
| verbose ); | verbose ); | ||||
| @@ -127,11 +127,9 @@ static enum PixelFormat GetFfmpegChromaFormat(SchroChromaFormat schro_pix_fmt) | |||||
| sizeof(ffmpeg_schro_pixel_format_map[0]); | sizeof(ffmpeg_schro_pixel_format_map[0]); | ||||
| int idx; | int idx; | ||||
| for (idx = 0; idx < num_formats; ++idx) { | |||||
| if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) { | |||||
| for (idx = 0; idx < num_formats; ++idx) | |||||
| if (ffmpeg_schro_pixel_format_map[idx].schro_pix_fmt == schro_pix_fmt) | |||||
| return ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt; | return ffmpeg_schro_pixel_format_map[idx].ff_pix_fmt; | ||||
| } | |||||
| } | |||||
| return PIX_FMT_NONE; | return PIX_FMT_NONE; | ||||
| } | } | ||||
| @@ -197,12 +195,10 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext) | |||||
| avccontext->time_base.num = p_schro_params->format->frame_rate_denominator; | avccontext->time_base.num = p_schro_params->format->frame_rate_denominator; | ||||
| if (!p_schro_params->dec_pic.data[0]) | if (!p_schro_params->dec_pic.data[0]) | ||||
| { | |||||
| avpicture_alloc(&p_schro_params->dec_pic, | avpicture_alloc(&p_schro_params->dec_pic, | ||||
| avccontext->pix_fmt, | avccontext->pix_fmt, | ||||
| avccontext->width, | avccontext->width, | ||||
| avccontext->height); | avccontext->height); | ||||
| } | |||||
| } | } | ||||
| static int libschroedinger_decode_frame(AVCodecContext *avccontext, | static int libschroedinger_decode_frame(AVCodecContext *avccontext, | ||||
| @@ -277,11 +273,10 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, | |||||
| /* Pull a frame out of the decoder. */ | /* Pull a frame out of the decoder. */ | ||||
| frame = schro_decoder_pull (decoder); | frame = schro_decoder_pull (decoder); | ||||
| if (frame) { | |||||
| if (frame) | |||||
| ff_dirac_schro_queue_push_back( | ff_dirac_schro_queue_push_back( | ||||
| &p_schro_params->dec_frame_queue, | &p_schro_params->dec_frame_queue, | ||||
| frame); | frame); | ||||
| } | |||||
| break; | break; | ||||
| case SCHRO_DECODER_EOS: | case SCHRO_DECODER_EOS: | ||||
| go = 0; | go = 0; | ||||
| @@ -150,10 +150,9 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) | |||||
| "gop_structure", | "gop_structure", | ||||
| SCHRO_ENCODER_GOP_INTRA_ONLY); | SCHRO_ENCODER_GOP_INTRA_ONLY); | ||||
| if (avccontext->coder_type == FF_CODER_TYPE_VLC) { | |||||
| if (avccontext->coder_type == FF_CODER_TYPE_VLC) | |||||
| schro_encoder_setting_set_double (p_schro_params->encoder, | schro_encoder_setting_set_double (p_schro_params->encoder, | ||||
| "enable_noarith", 1); | "enable_noarith", 1); | ||||
| } | |||||
| } | } | ||||
| else { | else { | ||||
| schro_encoder_setting_set_double (p_schro_params->encoder, | schro_encoder_setting_set_double (p_schro_params->encoder, | ||||
| @@ -194,12 +193,11 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) | |||||
| } | } | ||||
| if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) { | |||||
| if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) | |||||
| /* All material can be coded as interlaced or progressive | /* All material can be coded as interlaced or progressive | ||||
| irrespective of the type of source material. */ | irrespective of the type of source material. */ | ||||
| schro_encoder_setting_set_double (p_schro_params->encoder, | schro_encoder_setting_set_double (p_schro_params->encoder, | ||||
| "interlaced_coding", 1); | "interlaced_coding", 1); | ||||
| } | |||||
| /* FIXME: Signal range hardcoded to 8-bit data until both libschroedinger | /* FIXME: Signal range hardcoded to 8-bit data until both libschroedinger | ||||
| * and libdirac support other bit-depth data. */ | * and libdirac support other bit-depth data. */ | ||||
| @@ -324,9 +322,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, | |||||
| p_frame_output->size = p_schro_params->enc_buf_size; | p_frame_output->size = p_schro_params->enc_buf_size; | ||||
| p_frame_output->p_encbuf = p_schro_params->enc_buf; | p_frame_output->p_encbuf = p_schro_params->enc_buf; | ||||
| if (SCHRO_PARSE_CODE_IS_INTRA(parse_code) && | if (SCHRO_PARSE_CODE_IS_INTRA(parse_code) && | ||||
| SCHRO_PARSE_CODE_IS_REFERENCE(parse_code)) { | |||||
| SCHRO_PARSE_CODE_IS_REFERENCE(parse_code)) | |||||
| p_frame_output->key_frame = 1; | p_frame_output->key_frame = 1; | ||||
| } | |||||
| /* Parse the coded frame number from the bitstream. Bytes 14 | /* Parse the coded frame number from the bitstream. Bytes 14 | ||||
| * through 17 represesent the frame number. */ | * through 17 represesent the frame number. */ | ||||