<commit_before>/* jpeg.h
 * This code was written by <NAME> for gphoto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GPHOTO2_JPEG_H__
enum jpegmarker {
    JPEG_START=0xD8,    JPEG_APPO=0xE0,         JPEG_QUANTIZATION=0xDB,
    JPEG_HUFFMAN=0xC4,  JPEG_SSSEAHAL=0xDA,     JPEG_SOFC0=0xC0
};

const JPEG_MARKERS[] = {
    JPEG_START,         JPEG_APPO,              JPEG_QUANTIZATION,
    JPEG_HUFFMAN,       JPEG_SSSEAHAL,          JPEG_SOFC0
};

const char *JPEG_MARKERNAMES[] = {
    "Start",            "APPO",                 "Quantization table",
    "Huffman table",    "SsSeAhAl",             "SOFC0"
};

typedef struct chunk{
    int size;
    unsigned char *data;
} chunk;

void chunk_new(chunk *mychunk, int length);

void chunk_print(chunk *mychunk);

void chunk_destroy(chunk *mychunk);

typedef struct jpeg {
    int count;
    struct chunk marker[20]; /* I think this should be big enough */
}jpeg;

void jpeg_init(jpeg *myjpeg);

void jpeg_destroy(jpeg *myjpeg);

char jpeg_findff(int *location, chunk *picture);

char jpeg_findactivemarker(char *id, int *location, chunk *picture);

void jpeg_add_marker(jpeg *myjpeg, chunk *picture, int start, int end);

void jpeg_parse(jpeg *myjpeg, chunk *picture);

void jpeg_print(jpeg *myjpeg);

char *jpeg_markername(int c);

#endif<commit_msg>chunk_new now returns a pointer to a newly allocated chunk. quantization table handling added (including printing)<commit_after>/* jpeg.h
 * This code was written by <NAME> for gphoto
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __GPHOTO2_JPEG_H__
enum jpegmarker {
    JPEG_START=0xD8,    JPEG_APPO=0xE0,         JPEG_QUANTIZATION=0xDB,
    JPEG_HUFFMAN=0xC4,  JPEG_SSSEAHAL=0xDA,     JPEG_SOFC0=0xC0
};

const JPEG_MARKERS[] = {
    JPEG_START,         JPEG_APPO,              JPEG_QUANTIZATION,
    JPEG_HUFFMAN,       JPEG_SSSEAHAL,          JPEG_SOFC0
};

const char *JPEG_MARKERNAMES[] = {
    "Start",            "APPO",                 "Quantization table",
    "Huffman table",    "SsSeAhAl",             "SOFC0"
};

typedef struct chunk{
    int size;
    unsigned char *data;
} chunk;

typedef char jpeg_quantization_table[64];

chunk *chunk_new(int length);

void chunk_print(chunk *mychunk);

void chunk_destroy(chunk *mychunk);

typedef struct jpeg {
    int count;
    struct chunk *marker[20]; /* I think this should be big enough */
}jpeg;

void jpeg_init(jpeg *myjpeg);

void jpeg_destroy(jpeg *myjpeg);

char jpeg_findff(int *location, chunk *picture);

char jpeg_findactivemarker(char *id, int *location, chunk *picture);

void jpeg_add_marker(jpeg *myjpeg, chunk *picture, int start, int end);

void jpeg_parse(jpeg *myjpeg, chunk *picture);

void jpeg_print(jpeg *myjpeg);

char *jpeg_markername(int c);

chunk *jpeg_make_SOFC (int width, int height, char vh1, char vh2, char vh3);

#endif
{'fraction_non_alphanumeric': 0.08508626802174427, 'fraction_numerical': 0.015835499881824627, 'mean_word_length': 3.6301969365426694, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4072925', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1344, 'n_words': 487}