<commit_before>#include <math.h>
#include <sndfile.h>
#include <string.h>
#include <stdlib.h>

#include "./ebur128.h"

#define CHECK_ERROR(condition, message, errorcode, goto_point)                 \
  if ((condition)) {                                                           \
    fprintf(stderr, message);                                                  \
    errcode = (errorcode);                                                     \
    goto goto_point;                                                           \
  }


int main(int ac, const char* av[]) {
  SF_INFO file_info;
  SNDFILE* file;
  sf_count_t nr_frames_read;
  sf_count_t nr_frames_read_all = 0;
  ebur128_state* st;
  double* buffer;
  double relative_threshold, gated_loudness;
  int errcode = 0;
  int result;

  CHECK_ERROR(ac != 2, "usage: r128-test FILENAME\n", 1, exit)

  memset(&file_info, '\0', sizeof(file_info));
  if (av[1][0] == '-' && av[1][1] == '\0') {
    file = sf_open_fd(0, SFM_READ, &file_info, SF_FALSE);
  } else {
    file = sf_open(av[1], SFM_READ, &file_info);
  }
  CHECK_ERROR(!file, "Could not open input file!\n", 1, exit)

  st = ebur128_init( (size_t) file_info.frames, file_info.channels);
  CHECK_ERROR(!st, "Could not initialize EBU R128!\n", 1, close_file)<commit_msg>only sample rate 48000 is supported for now<commit_after>#include <math.h>
#include <sndfile.h>
#include <string.h>
#include <stdlib.h>

#include "./ebur128.h"

#define CHECK_ERROR(condition, message, errorcode, goto_point)                 \
  if ((condition)) {                                                           \
    fprintf(stderr, message);                                                  \
    errcode = (errorcode);                                                     \
    goto goto_point;                                                           \
  }


int main(int ac, const char* av[]) {
  SF_INFO file_info;
  SNDFILE* file;
  sf_count_t nr_frames_read;
  sf_count_t nr_frames_read_all = 0;
  ebur128_state* st;
  double* buffer;
  double relative_threshold, gated_loudness;
  int errcode = 0;
  int result;

  CHECK_ERROR(ac != 2, "usage: r128-test FILENAME\n", 1, exit)

  memset(&file_info, '\0', sizeof(file_info));
  if (av[1][0] == '-' && av[1][1] == '\0') {
    file = sf_open_fd(0, SFM_READ, &file_info, SF_FALSE);
  } else {
    file = sf_open(av[1], SFM_READ, &file_info);
  }
  CHECK_ERROR(!file, "Could not open input file!\n", 1, exit)
  CHECK_ERROR(file_info.samplerate != 48000,
              "Only 48000 kHz sample rate is supported.\n", 1, close_file)

  st = ebur128_init( (size_t) file_info.frames, file_info.channels);
  CHECK_ERROR(!st, "Could not initialize EBU R128!\n", 1, close_file)
{'fraction_non_alphanumeric': 0.12841328413284134, 'fraction_numerical': 0.02730627306273063, 'mean_word_length': 1.9758507135016465, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2295130', 'n_tokens_mistral': 928, 'n_tokens_neox': 870, 'n_words': 207}