Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.4KB

  1. /*
  2. * jcinit.c
  3. *
  4. * Copyright (C) 1991-1997, Thomas G. Lane.
  5. * This file is part of the Independent JPEG Group's software.
  6. * For conditions of distribution and use, see the accompanying README file.
  7. *
  8. * This file contains initialization logic for the JPEG compressor.
  9. * This routine is in charge of selecting the modules to be executed and
  10. * making an initialization call to each one.
  11. *
  12. * Logically, this code belongs in jcmaster.c. It's split out because
  13. * linking this routine implies linking the entire compression library.
  14. * For a transcoding-only application, we want to be able to use jcmaster.c
  15. * without linking in the whole library.
  16. */
  17. #define JPEG_INTERNALS
  18. #include "jinclude.h"
  19. #include "jpeglib.h"
  20. /*
  21. * Master selection of compression modules.
  22. * This is done once at the start of processing an image. We determine
  23. * which modules will be used and give them appropriate initialization calls.
  24. */
  25. GLOBAL(void)
  26. jinit_compress_master (j_compress_ptr cinfo)
  27. {
  28. /* Initialize master control (includes parameter checking/processing) */
  29. jinit_c_master_control(cinfo, FALSE /* full compression */);
  30. /* Preprocessing */
  31. if (! cinfo->raw_data_in) {
  32. jinit_color_converter(cinfo);
  33. jinit_downsampler(cinfo);
  34. jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
  35. }
  36. /* Forward DCT */
  37. jinit_forward_dct(cinfo);
  38. /* Entropy encoding: either Huffman or arithmetic coding. */
  39. if (cinfo->arith_code) {
  40. ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  41. } else {
  42. if (cinfo->progressive_mode) {
  43. #ifdef C_PROGRESSIVE_SUPPORTED
  44. jinit_phuff_encoder(cinfo);
  45. #else
  46. ERREXIT(cinfo, JERR_NOT_COMPILED);
  47. #endif
  48. } else
  49. jinit_huff_encoder(cinfo);
  50. }
  51. /* Need a full-image coefficient buffer in any multi-pass mode. */
  52. jinit_c_coef_controller(cinfo,
  53. (boolean) (cinfo->num_scans > 1 || cinfo->optimize_coding));
  54. jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
  55. jinit_marker_writer(cinfo);
  56. /* We can now tell the memory manager to allocate virtual arrays. */
  57. (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
  58. /* Write the datastream header (SOI) immediately.
  59. * Frame and scan headers are postponed till later.
  60. * This lets application insert special markers after the SOI.
  61. */
  62. (*cinfo->marker->write_file_header) (cinfo);
  63. }