transcode-1.1.7-ffmpeg4.patch 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. Index: transcode-1.1.7/encode/encode_lavc.c
  2. ===================================================================
  3. --- transcode-1.1.7.orig/encode/encode_lavc.c
  4. +++ transcode-1.1.7/encode/encode_lavc.c
  5. @@ -77,6 +77,13 @@ struct tclavcconfigdata_ {
  6. int luma_elim_threshold;
  7. int chroma_elim_threshold;
  8. int quantizer_noise_shaping;
  9. + int inter_quant_bias;
  10. + int intra_quant_bias;
  11. + int scenechange_factor;
  12. + int rc_strategy;
  13. + float rc_initial_cplx;
  14. + float rc_qsquish;
  15. + float border_masking;
  16. /* same as above for flags */
  17. struct {
  18. @@ -684,7 +691,7 @@ static int tc_lavc_init_multipass(TCLavc
  19. switch (vob->divxmultipass) {
  20. case 1:
  21. CAN_DO_MULTIPASS(multipass_flag);
  22. - pd->ff_vcontext.flags |= CODEC_FLAG_PASS1;
  23. + pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS1;
  24. pd->stats_file = fopen(vob->divxlogfile, "w");
  25. if (pd->stats_file == NULL) {
  26. tc_log_error(MOD_NAME, "could not create 2pass log file"
  27. @@ -694,7 +701,7 @@ static int tc_lavc_init_multipass(TCLavc
  28. break;
  29. case 2:
  30. CAN_DO_MULTIPASS(multipass_flag);
  31. - pd->ff_vcontext.flags |= CODEC_FLAG_PASS2;
  32. + pd->ff_vcontext.flags |= AV_CODEC_FLAG_PASS2;
  33. pd->stats_file = fopen(vob->divxlogfile, "r");
  34. if (pd->stats_file == NULL){
  35. tc_log_error(MOD_NAME, "could not open 2pass log file \"%s\""
  36. @@ -723,7 +730,7 @@ static int tc_lavc_init_multipass(TCLavc
  37. break;
  38. case 3:
  39. /* fixed qscale :p */
  40. - pd->ff_vcontext.flags |= CODEC_FLAG_QSCALE;
  41. + pd->ff_vcontext.flags |= AV_CODEC_FLAG_QSCALE;
  42. pd->ff_venc_frame.quality = vob->divxbitrate;
  43. break;
  44. }
  45. @@ -970,7 +977,7 @@ static void tc_lavc_config_defaults(TCLa
  46. pd->confdata.rc_buffer_size = 0;
  47. pd->confdata.lmin = 2;
  48. pd->confdata.lmax = 31;
  49. - pd->confdata.me_method = ME_EPZS;
  50. + pd->confdata.me_method = 0;
  51. memset(&pd->confdata.flags, 0, sizeof(pd->confdata.flags));
  52. pd->confdata.turbo_setup = 0;
  53. @@ -983,12 +990,12 @@ static void tc_lavc_config_defaults(TCLa
  54. pd->ff_vcontext.me_range = 0;
  55. pd->ff_vcontext.mb_decision = 0;
  56. pd->ff_vcontext.scenechange_threshold = 0;
  57. - pd->ff_vcontext.scenechange_factor = 1;
  58. + pd->confdata.scenechange_factor = 1;
  59. pd->ff_vcontext.b_frame_strategy = 0;
  60. pd->ff_vcontext.b_sensitivity = 40;
  61. pd->ff_vcontext.brd_scale = 0;
  62. pd->ff_vcontext.bidir_refine = 0;
  63. - pd->ff_vcontext.rc_strategy = 2;
  64. + pd->confdata.rc_strategy = 2;
  65. pd->ff_vcontext.b_quant_factor = 1.25;
  66. pd->ff_vcontext.i_quant_factor = 0.8;
  67. pd->ff_vcontext.b_quant_offset = 1.25;
  68. @@ -996,8 +1003,8 @@ static void tc_lavc_config_defaults(TCLa
  69. pd->ff_vcontext.qblur = 0.5;
  70. pd->ff_vcontext.qcompress = 0.5;
  71. pd->ff_vcontext.mpeg_quant = 0;
  72. - pd->ff_vcontext.rc_initial_cplx = 0.0;
  73. - pd->ff_vcontext.rc_qsquish = 1.0;
  74. + pd->confdata.rc_initial_cplx = 0.0;
  75. + pd->confdata.rc_qsquish = 1.0;
  76. pd->confdata.luma_elim_threshold = 0;
  77. pd->confdata.chroma_elim_threshold = 0;
  78. pd->ff_vcontext.strict_std_compliance = 0;
  79. @@ -1008,7 +1015,7 @@ static void tc_lavc_config_defaults(TCLa
  80. pd->ff_vcontext.temporal_cplx_masking = 0.0;
  81. pd->ff_vcontext.spatial_cplx_masking = 0.0;
  82. pd->ff_vcontext.p_masking = 0.0;
  83. - pd->ff_vcontext.border_masking = 0.0;
  84. + pd->confdata.border_masking = 0.0;
  85. pd->ff_vcontext.me_pre_cmp = 0;
  86. pd->ff_vcontext.me_cmp = 0;
  87. pd->ff_vcontext.me_sub_cmp = 0;
  88. @@ -1020,8 +1027,6 @@ static void tc_lavc_config_defaults(TCLa
  89. pd->ff_vcontext.pre_me = 1;
  90. pd->ff_vcontext.me_subpel_quality = 8;
  91. pd->ff_vcontext.refs = 1;
  92. - pd->ff_vcontext.intra_quant_bias = FF_DEFAULT_QUANT_BIAS;
  93. - pd->ff_vcontext.inter_quant_bias = FF_DEFAULT_QUANT_BIAS;
  94. pd->ff_vcontext.noise_reduction = 0;
  95. pd->confdata.quantizer_noise_shaping = 0;
  96. pd->ff_vcontext.flags = 0;
  97. @@ -1044,19 +1049,19 @@ static void tc_lavc_config_defaults(TCLa
  98. */
  99. static void tc_lavc_dispatch_settings(TCLavcPrivateData *pd)
  100. {
  101. + char buf[1024];
  102. /* some translation... */
  103. pd->ff_vcontext.bit_rate_tolerance = pd->confdata.vrate_tolerance * 1000;
  104. pd->ff_vcontext.rc_min_rate = pd->confdata.rc_min_rate * 1000;
  105. pd->ff_vcontext.rc_max_rate = pd->confdata.rc_max_rate * 1000;
  106. pd->ff_vcontext.rc_buffer_size = pd->confdata.rc_buffer_size * 1024;
  107. - pd->ff_vcontext.lmin = (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5);
  108. - pd->ff_vcontext.lmax = (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5);
  109. - pd->ff_vcontext.me_method = ME_ZERO + pd->confdata.me_method;
  110. + snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmin + 0.5));
  111. + av_dict_set(&(pd->ff_opts), "lmin", buf, 0);
  112. + snprintf(buf, sizeof(buf), "%i", (int)(FF_QP2LAMBDA * pd->confdata.lmax + 0.5));
  113. + av_dict_set(&(pd->ff_opts), "lmax", buf, 0);
  114. pd->ff_vcontext.flags = 0;
  115. - SET_FLAG(pd, mv0);
  116. SET_FLAG(pd, qpel);
  117. - SET_FLAG(pd, naq);
  118. SET_FLAG(pd, ilme);
  119. SET_FLAG(pd, ildct);
  120. SET_FLAG(pd, aic);
  121. @@ -1077,8 +1082,8 @@ static void tc_lavc_dispatch_settings(TC
  122. }
  123. if (pd->interlacing.active) {
  124. /* enforce interlacing */
  125. - pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_DCT;
  126. - pd->ff_vcontext.flags |= CODEC_FLAG_INTERLACED_ME;
  127. + pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_DCT;
  128. + pd->ff_vcontext.flags |= AV_CODEC_FLAG_INTERLACED_ME;
  129. }
  130. if (pd->confdata.flags.alt) {
  131. av_dict_set(&(pd->ff_opts), "alternate_scan", "1", 0);
  132. @@ -1095,15 +1100,31 @@ static void tc_lavc_dispatch_settings(TC
  133. if (pd->confdata.flags.cbp) {
  134. av_dict_set(&(pd->ff_opts), "mpv_flags", "+cbp_rd", 0);
  135. }
  136. + if (pd->confdata.flags.mv0) {
  137. + av_dict_set(&(pd->ff_opts), "mpv_flags", "+mv0", 0);
  138. + }
  139. + if (pd->confdata.flags.naq) {
  140. + av_dict_set(&(pd->ff_opts), "mpv_flags", "+naq", 0);
  141. + }
  142. - char buf[1024];
  143. #define set_dict_opt(val, opt) \
  144. snprintf(buf, sizeof(buf), "%i", pd->confdata.val);\
  145. av_dict_set(&(pd->ff_opts), opt, buf, 0)
  146. +#define set_dict_float_opt(val, opt) \
  147. + snprintf(buf, sizeof(buf), "%f", pd->confdata.val);\
  148. + av_dict_set(&(pd->ff_opts), opt, buf, 0)
  149. set_dict_opt(luma_elim_threshold, "luma_elim_threshold");
  150. set_dict_opt(chroma_elim_threshold, "chroma_elim_threshold");
  151. set_dict_opt(quantizer_noise_shaping, "quantizer_noise_shaping");
  152. + set_dict_opt(inter_quant_bias, "pbias");
  153. + set_dict_opt(intra_quant_bias, "ibias");
  154. + set_dict_opt(me_method, "me_method");
  155. + set_dict_opt(scenechange_factor, "sc_factor");
  156. + set_dict_opt(rc_strategy, "rc_strategy");
  157. + set_dict_float_opt(rc_initial_cplx, "rc_init_cplx");
  158. + set_dict_float_opt(rc_qsquish, "qsquish");
  159. + set_dict_float_opt(border_masking, "border_mask");
  160. }
  161. #undef SET_FLAG
  162. @@ -1159,12 +1180,12 @@ static int tc_lavc_read_config(TCLavcPri
  163. { "lmin", PAUX(lmin), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
  164. { "lmax", PAUX(lmax), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.01, 255.0 },
  165. { "vqdiff", PCTX(max_qdiff), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31 },
  166. - { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES },
  167. + { "vmax_b_frames", PCTX(max_b_frames), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX },
  168. { "vme", PAUX(me_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16, },
  169. { "me_range", PCTX(me_range), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000 },
  170. { "mbd", PCTX(mb_decision), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
  171. { "sc_threshold", PCTX(scenechange_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000 },
  172. - { "sc_factor", PCTX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
  173. + { "sc_factor", PAUX(scenechange_factor), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16 },
  174. { "vb_strategy", PCTX(b_frame_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
  175. { "b_sensitivity", PCTX(b_sensitivity), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 100 },
  176. { "brd_scale", PCTX(brd_scale), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10 },
  177. @@ -1175,7 +1196,7 @@ static int tc_lavc_read_config(TCLavcPri
  178. { "vrc_maxrate", PAUX(rc_max_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
  179. { "vrc_minrate", PAUX(rc_min_rate), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 24000000 },
  180. { "vrc_buf_size", PAUX(rc_buffer_size), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000 },
  181. - { "vrc_strategy", PCTX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
  182. + { "vrc_strategy", PAUX(rc_strategy), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2 },
  183. { "vb_qfactor", PCTX(b_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
  184. { "vi_qfactor", PCTX(i_quant_factor), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0 },
  185. { "vb_qoffset", PCTX(b_quant_offset), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0 },
  186. @@ -1185,9 +1206,9 @@ static int tc_lavc_read_config(TCLavcPri
  187. { "mpeg_quant", PCTX(mpeg_quant), TCCONF_TYPE_FLAG, 0, 0, 1 },
  188. // { "vrc_eq", }, // not yet supported
  189. { "vrc_override", rc_override_buf, TCCONF_TYPE_STRING, 0, 0, 0 },
  190. - { "vrc_init_cplx", PCTX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
  191. + { "vrc_init_cplx", PAUX(rc_initial_cplx), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 9999999.0 },
  192. // { "vrc_init_occupancy", }, // not yet supported
  193. - { "vqsquish", PCTX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
  194. + { "vqsquish", PAUX(rc_qsquish), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 99.0 },
  195. { "vlelim", PAUX(luma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
  196. { "vcelim", PAUX(chroma_elim_threshold), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
  197. { "vstrict", PCTX(strict_std_compliance), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99 },
  198. @@ -1199,7 +1220,7 @@ static int tc_lavc_read_config(TCLavcPri
  199. { "tcplx_mask", PCTX(temporal_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
  200. { "scplx_mask", PCTX(spatial_cplx_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
  201. { "p_mask", PCTX(p_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
  202. - { "border_mask", PCTX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
  203. + { "border_mask", PAUX(border_masking), TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0 },
  204. { "pred", PCTX(prediction_method), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 4 },
  205. { "precmp", PCTX(me_pre_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
  206. { "cmp", PCTX(me_cmp), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000 },
  207. @@ -1212,37 +1233,37 @@ static int tc_lavc_read_config(TCLavcPri
  208. { "pre_me", PCTX(pre_me), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
  209. { "subq", PCTX(me_subpel_quality), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8 },
  210. { "refs", PCTX(refs), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 8 },
  211. - { "ibias", PCTX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
  212. - { "pbias", PCTX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
  213. + { "ibias", PAUX(intra_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
  214. + { "pbias", PAUX(inter_quant_bias), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512 },
  215. { "nr", PCTX(noise_reduction), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
  216. { "qns", PAUX(quantizer_noise_shaping), TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 3 },
  217. { "inter_matrix_file", inter_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
  218. { "intra_matrix_file", intra_matrix_file, TCCONF_TYPE_STRING, 0, 0, 0 },
  219. - { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0 },
  220. + { "mv0", PAUX(flags.mv0), TCCONF_TYPE_FLAG, 0, 0, 1 },
  221. { "cbp", PAUX(flags.cbp), TCCONF_TYPE_FLAG, 0, 0, 1 },
  222. - { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL },
  223. + { "qpel", PAUX(flags.qpel), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL },
  224. { "alt", PAUX(flags.alt), TCCONF_TYPE_FLAG, 0, 0, 1 },
  225. - { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME },
  226. - { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_DCT },
  227. - { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_NORMALIZE_AQP },
  228. + { "ilme", PAUX(flags.ilme), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME },
  229. + { "ildct", PAUX(flags.ildct), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_DCT },
  230. + { "naq", PAUX(flags.naq), TCCONF_TYPE_FLAG, 0, 0, 1 },
  231. { "vdpart", PAUX(flags.vdpart), TCCONF_TYPE_FLAG, 0, 0, 1 },
  232. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  233. { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC },
  234. #else
  235. - { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED },
  236. + { "aic", PAUX(flags.aic), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED },
  237. #endif
  238. { "aiv", PAUX(flags.aiv), TCCONF_TYPE_FLAG, 0, 0, 1 },
  239. { "umv", PAUX(flags.umv), TCCONF_TYPE_FLAG, 0, 0, 1 },
  240. - { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR },
  241. + { "psnr", PAUX(flags.psnr), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR },
  242. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  243. { "trell", PAUX(flags.trell), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT },
  244. #else
  245. { "trell", PCTX(trellis), TCCONF_TYPE_FLAG, 0, 0, 1 },
  246. #endif
  247. - { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY },
  248. - { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV },
  249. - { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP },
  250. + { "gray", PAUX(flags.gray), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY },
  251. + { "v4mv", PAUX(flags.v4mv), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV },
  252. + { "closedgop", PAUX(flags.closedgop), TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP },
  253. // { "turbo", PAUX(turbo_setup), TCCONF_TYPE_FLAG, 0, 0, 1 }, // not yet supported
  254. /* End of the config file */
  255. Index: transcode-1.1.7/export/export_ffmpeg.c
  256. ===================================================================
  257. --- transcode-1.1.7.orig/export/export_ffmpeg.c
  258. +++ transcode-1.1.7/export/export_ffmpeg.c
  259. @@ -831,14 +831,11 @@ MOD_init
  260. lavc_venc_context->bit_rate = vob->divxbitrate * 1000;
  261. lavc_venc_context->bit_rate_tolerance = lavc_param_vrate_tolerance * 1000;
  262. - lavc_venc_context->lmin= (int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5);
  263. - lavc_venc_context->lmax= (int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5);
  264. lavc_venc_context->max_qdiff = lavc_param_vqdiff;
  265. lavc_venc_context->qcompress = lavc_param_vqcompress;
  266. lavc_venc_context->qblur = lavc_param_vqblur;
  267. lavc_venc_context->max_b_frames = lavc_param_vmax_b_frames;
  268. lavc_venc_context->b_quant_factor = lavc_param_vb_qfactor;
  269. - lavc_venc_context->rc_strategy = lavc_param_vrc_strategy;
  270. lavc_venc_context->b_frame_strategy = lavc_param_vb_strategy;
  271. lavc_venc_context->b_quant_offset = lavc_param_vb_qoffset;
  272. @@ -846,8 +843,23 @@ MOD_init
  273. #define set_dict_opt(val, opt) \
  274. snprintf(buf, sizeof(buf), "%i", val); \
  275. av_dict_set(&lavc_venc_opts, opt, buf, 0)
  276. +#define set_dict_float_opt(val, opt) \
  277. + snprintf(buf, sizeof(buf), "%f", val); \
  278. + av_dict_set(&lavc_venc_opts, opt, buf, 0)
  279. set_dict_opt(lavc_param_luma_elim_threshold, "luma_elim_threshold");
  280. set_dict_opt(lavc_param_chroma_elim_threshold, "chroma_elim_threshold");
  281. + set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmin + 0.5), "lmin");
  282. + set_dict_opt((int)(FF_QP2LAMBDA * lavc_param_lmax + 0.5), "lmax");
  283. + set_dict_opt(lavc_param_vrc_strategy, "rc_strategy");
  284. + set_dict_float_opt(lavc_param_rc_qsquish, "qsquish");
  285. + set_dict_float_opt(lavc_param_rc_qmod_amp, "rc_qmod_amp");
  286. + set_dict_opt(lavc_param_rc_qmod_freq, "rc_qmod_freq");
  287. + set_dict_opt(lavc_param_rc_eq, "rc_eq");
  288. + set_dict_opt(lavc_param_vme, "me_method");
  289. + set_dict_opt(lavc_param_ibias, "ibias");
  290. + set_dict_opt(lavc_param_pbias, "pbias");
  291. + set_dict_float_opt(lavc_param_rc_buffer_aggressivity, "rc_buf_aggressivity");
  292. + set_dict_float_opt(lavc_param_rc_initial_cplx, "rc_init_cplx");
  293. lavc_venc_context->rtp_payload_size = lavc_param_packet_size;
  294. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  295. if (lavc_param_packet_size)
  296. @@ -856,15 +868,9 @@ MOD_init
  297. lavc_venc_context->strict_std_compliance= lavc_param_strict;
  298. lavc_venc_context->i_quant_factor = lavc_param_vi_qfactor;
  299. lavc_venc_context->i_quant_offset = lavc_param_vi_qoffset;
  300. - lavc_venc_context->rc_qsquish = lavc_param_rc_qsquish;
  301. - lavc_venc_context->rc_qmod_amp = lavc_param_rc_qmod_amp;
  302. - lavc_venc_context->rc_qmod_freq = lavc_param_rc_qmod_freq;
  303. - lavc_venc_context->rc_eq = lavc_param_rc_eq;
  304. lavc_venc_context->rc_max_rate = lavc_param_rc_max_rate * 1000;
  305. lavc_venc_context->rc_min_rate = lavc_param_rc_min_rate * 1000;
  306. lavc_venc_context->rc_buffer_size = lavc_param_rc_buffer_size * 1024;
  307. - lavc_venc_context->rc_buffer_aggressivity= lavc_param_rc_buffer_aggressivity;
  308. - lavc_venc_context->rc_initial_cplx = lavc_param_rc_initial_cplx;
  309. lavc_venc_context->debug = lavc_param_debug;
  310. lavc_venc_context->last_predictor_count= lavc_param_last_pred;
  311. lavc_venc_context->pre_me = lavc_param_pre_me;
  312. @@ -872,8 +878,6 @@ MOD_init
  313. lavc_venc_context->pre_dia_size = lavc_param_pre_dia_size;
  314. lavc_venc_context->me_subpel_quality = lavc_param_me_subpel_quality;
  315. lavc_venc_context->me_range = lavc_param_me_range;
  316. - lavc_venc_context->intra_quant_bias = lavc_param_ibias;
  317. - lavc_venc_context->inter_quant_bias = lavc_param_pbias;
  318. lavc_venc_context->coder_type = lavc_param_coder;
  319. lavc_venc_context->context_model = lavc_param_context;
  320. lavc_venc_context->scenechange_threshold= lavc_param_sc_threshold;
  321. @@ -1079,6 +1083,8 @@ MOD_init
  322. lavc_venc_context->flags |= lavc_param_mv0;
  323. if(lavc_param_qp_rd)
  324. av_dict_set(&lavc_venc_opts, "mpv_flags", "+qp_rd", 0);
  325. + if (lavc_param_normalize_aqp)
  326. + av_dict_set(&lavc_venc_opts, "mpv_flags", "+naq", 0);
  327. lavc_venc_context->flags |= lavc_param_ilme;
  328. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  329. lavc_venc_context->flags |= lavc_param_trell;
  330. @@ -1087,9 +1093,7 @@ MOD_init
  331. #endif
  332. if (lavc_param_gray)
  333. - lavc_venc_context->flags |= CODEC_FLAG_GRAY;
  334. - if (lavc_param_normalize_aqp)
  335. - lavc_venc_context->flags |= CODEC_FLAG_NORMALIZE_AQP;
  336. + lavc_venc_context->flags |= AV_CODEC_FLAG_GRAY;
  337. switch(vob->encode_fields) {
  338. case TC_ENCODE_FIELDS_TOP_FIRST:
  339. @@ -1107,9 +1111,9 @@ MOD_init
  340. }
  341. lavc_venc_context->flags |= interlacing_active ?
  342. - CODEC_FLAG_INTERLACED_DCT : 0;
  343. + AV_CODEC_FLAG_INTERLACED_DCT : 0;
  344. lavc_venc_context->flags |= interlacing_active ?
  345. - CODEC_FLAG_INTERLACED_ME : 0;
  346. + AV_CODEC_FLAG_INTERLACED_ME : 0;
  347. lavc_venc_context->flags |= lavc_param_psnr;
  348. do_psnr = lavc_param_psnr;
  349. @@ -1156,7 +1160,7 @@ MOD_init
  350. "encoding.");
  351. return TC_EXPORT_ERROR;
  352. }
  353. - lavc_venc_context->flags |= CODEC_FLAG_PASS1;
  354. + lavc_venc_context->flags |= AV_CODEC_FLAG_PASS1;
  355. stats_file = fopen(vob->divxlogfile, "w");
  356. if (stats_file == NULL){
  357. tc_log_warn(MOD_NAME, "Could not create 2pass log file \"%s\".",
  358. @@ -1170,7 +1174,7 @@ MOD_init
  359. "encoding.");
  360. return TC_EXPORT_ERROR;
  361. }
  362. - lavc_venc_context->flags |= CODEC_FLAG_PASS2;
  363. + lavc_venc_context->flags |= AV_CODEC_FLAG_PASS2;
  364. stats_file= fopen(vob->divxlogfile, "r");
  365. if (stats_file==NULL){
  366. tc_log_warn(MOD_NAME, "Could not open 2pass log file \"%s\" for "
  367. @@ -1201,12 +1205,11 @@ MOD_init
  368. break;
  369. case 3:
  370. /* fixed qscale :p */
  371. - lavc_venc_context->flags |= CODEC_FLAG_QSCALE;
  372. + lavc_venc_context->flags |= AV_CODEC_FLAG_QSCALE;
  373. lavc_venc_frame->quality = vob->divxbitrate;
  374. break;
  375. }
  376. - lavc_venc_context->me_method = ME_ZERO + lavc_param_vme;
  377. /* FIXME: transcode itself contains "broken ffmpeg default settings", thus we need to override them! */
  378. if (lavc_param_video_preset && strcmp(lavc_param_video_preset, "none")) {
  379. Index: transcode-1.1.7/export/ffmpeg_cfg.c
  380. ===================================================================
  381. --- transcode-1.1.7.orig/export/ffmpeg_cfg.c
  382. +++ transcode-1.1.7/export/ffmpeg_cfg.c
  383. @@ -93,8 +93,8 @@ int lavc_param_last_pred= 0;
  384. int lavc_param_pre_me= 1;
  385. int lavc_param_me_subpel_quality= 8;
  386. int lavc_param_me_range=0;
  387. -int lavc_param_ibias=FF_DEFAULT_QUANT_BIAS;
  388. -int lavc_param_pbias=FF_DEFAULT_QUANT_BIAS;
  389. +int lavc_param_ibias=0;
  390. +int lavc_param_pbias=0;
  391. int lavc_param_coder=0;
  392. int lavc_param_context=0;
  393. char *lavc_param_intra_matrix = NULL;
  394. @@ -136,7 +136,7 @@ TCConfigEntry lavcopts_conf[]={
  395. {"vratetol", &lavc_param_vrate_tolerance, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 4, 24000000},
  396. {"vhq", &lavc_param_mb_decision, TCCONF_TYPE_FLAG, 0, 0, 1},
  397. {"mbd", &lavc_param_mb_decision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 9},
  398. - {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_4MV},
  399. + {"v4mv", &lavc_param_v4mv, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_4MV},
  400. {"vme", &lavc_param_vme, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 5},
  401. // {"vqscale", &lavc_param_vqscale, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
  402. // {"vqmin", &lavc_param_vqmin, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 31},
  403. @@ -147,7 +147,7 @@ TCConfigEntry lavcopts_conf[]={
  404. {"vqcomp", &lavc_param_vqcompress, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
  405. {"vqblur", &lavc_param_vqblur, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 1.0},
  406. {"vb_qfactor", &lavc_param_vb_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
  407. - {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, FF_MAX_B_FRAMES},
  408. + {"vmax_b_frames", &lavc_param_vmax_b_frames, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, INT_MAX},
  409. // {"vpass", &lavc_param_vpass, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
  410. {"vrc_strategy", &lavc_param_vrc_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2},
  411. {"vb_strategy", &lavc_param_vb_strategy, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 10},
  412. @@ -158,7 +158,7 @@ TCConfigEntry lavcopts_conf[]={
  413. {"vstrict", &lavc_param_strict, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -99, 99},
  414. {"vdpart", &lavc_param_data_partitioning, TCCONF_TYPE_FLAG, 0, 0, 1},
  415. // {"keyint", &lavc_param_keyint, TCCONF_TYPE_INT, 0, 0, 0},
  416. - {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GRAY},
  417. + {"gray", &lavc_param_gray, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_GRAY},
  418. {"mpeg_quant", &lavc_param_mpeg_quant, TCCONF_TYPE_FLAG, 0, 0, 1},
  419. {"vi_qfactor", &lavc_param_vi_qfactor, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, -31.0, 31.0},
  420. {"vi_qoffset", &lavc_param_vi_qoffset, TCCONF_TYPE_FLOAT, TCCONF_FLAG_RANGE, 0.0, 31.0},
  421. @@ -184,7 +184,7 @@ TCConfigEntry lavcopts_conf[]={
  422. {"pred", &lavc_param_prediction_method, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 20},
  423. {"format", &lavc_param_format, TCCONF_TYPE_STRING, 0, 0, 0},
  424. {"debug", &lavc_param_debug, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 100000000},
  425. - {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PSNR},
  426. + {"psnr", &lavc_param_psnr, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_PSNR},
  427. {"precmp", &lavc_param_me_pre_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
  428. {"cmp", &lavc_param_me_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
  429. {"subcmp", &lavc_param_me_sub_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
  430. @@ -192,9 +192,9 @@ TCConfigEntry lavcopts_conf[]={
  431. {"ildctcmp", &lavc_param_ildct_cmp, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 2000},
  432. {"predia", &lavc_param_pre_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
  433. {"dia", &lavc_param_dia_size, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -2000, 2000},
  434. - {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_QPEL},
  435. + {"qpel", &lavc_param_qpel, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_QPEL},
  436. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  437. - {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRELLIS_QUANT},
  438. + {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRELLIS_QUANT},
  439. #else
  440. {"trell", &lavc_param_trell, TCCONF_TYPE_FLAG, 0, 0, 1},
  441. #endif
  442. @@ -203,9 +203,9 @@ TCConfigEntry lavcopts_conf[]={
  443. {"subq", &lavc_param_me_subpel_quality, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 8},
  444. {"me_range", &lavc_param_me_range, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16000},
  445. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  446. - {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_H263P_AIC},
  447. + {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_H263P_AIC},
  448. #else
  449. - {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_AC_PRED},
  450. + {"aic", &lavc_param_aic, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_AC_PRED},
  451. #endif
  452. {"umv", &lavc_param_umv, TCCONF_TYPE_FLAG, 0, 0, 1},
  453. {"ibias", &lavc_param_ibias, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -512, 512},
  454. @@ -215,20 +215,20 @@ TCConfigEntry lavcopts_conf[]={
  455. {"intra_matrix", &lavc_param_intra_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
  456. {"inter_matrix", &lavc_param_inter_matrix, TCCONF_TYPE_STRING, 0, 0, 0},
  457. {"cbp", &lavc_param_cbp, TCCONF_TYPE_FLAG, 0, 0, 1},
  458. - {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_MV0},
  459. + {"mv0", &lavc_param_mv0, TCCONF_TYPE_FLAG, 0, 0, 1},
  460. {"nr", &lavc_param_noise_reduction, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000000},
  461. {"qprd", &lavc_param_qp_rd, TCCONF_TYPE_FLAG, 0, 0, 1},
  462. {"threads", &lavc_param_threads, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 1, 16},
  463. {"ss", &lavc_param_ss, TCCONF_TYPE_FLAG, 0, 0, 1},
  464. {"svcd_sof", &lavc_param_scan_offset, TCCONF_TYPE_FLAG, 0, 0, 1},
  465. {"alt", &lavc_param_alt, TCCONF_TYPE_FLAG, 0, 0, 1},
  466. - {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_INTERLACED_ME},
  467. + {"ilme", &lavc_param_ilme, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_INTERLACED_ME},
  468. {"inter_threshold", &lavc_param_inter_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
  469. {"sc_threshold", &lavc_param_sc_threshold, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1000000, 1000000},
  470. {"top", &lavc_param_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, -1, 1},
  471. - {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_GMC},
  472. - {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_TRUNCATED},
  473. - {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, CODEC_FLAG_CLOSED_GOP},
  474. + {"gmc", &lavc_param_gmc, TCCONF_TYPE_FLAG, 0, 0, 1},
  475. + {"trunc", &lavc_param_trunc, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_TRUNCATED},
  476. + {"closedgop", &lavc_param_closedgop, TCCONF_TYPE_FLAG, 0, 0, AV_CODEC_FLAG_CLOSED_GOP},
  477. {"intra_dc_precision", &lavc_param_intra_dc_precision, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 16},
  478. {"skip_top", &lavc_param_skip_top, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
  479. {"skip_bottom", &lavc_param_skip_bottom, TCCONF_TYPE_INT, TCCONF_FLAG_RANGE, 0, 1000},
  480. Index: transcode-1.1.7/import/import_ffmpeg.c
  481. ===================================================================
  482. --- transcode-1.1.7.orig/import/import_ffmpeg.c
  483. +++ transcode-1.1.7/import/import_ffmpeg.c
  484. @@ -361,7 +361,7 @@ do_avi:
  485. lavc_dec_context->width = x_dim;
  486. lavc_dec_context->height = y_dim;
  487. - if (vob->decolor) lavc_dec_context->flags |= CODEC_FLAG_GRAY;
  488. + if (vob->decolor) lavc_dec_context->flags |= AV_CODEC_FLAG_GRAY;
  489. #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
  490. lavc_dec_context->error_resilience = 2;
  491. #else