This also involves making some function static and changing the name prefixes of some functions and structures.
Unified · Split
| @@ -601,11 +601,9 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o · 600 unmodified lines | |||
| 601 | OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o | 601 | OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o |
| 602 | OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpeg.o | 602 | OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpeg.o |
| 603 | OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ | 603 | OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ |
| 604 | libschroedinger.o \ | 604 | libschroedinger.o |
| 605 | libdirac_libschro.o | ||
| 606 | OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ | 605 | OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ |
| 607 | libschroedinger.o \ | 606 | libschroedinger.o |
| 608 | libdirac_libschro.o | ||
| 609 | OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o | 607 | OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o |
| 610 | OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o | 608 | OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o |
| 611 | OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o | 609 | OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o |
| @@ -1,113 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > | ||
| 3 | * | ||
| 4 | * This file is part of Libav. | ||
| 5 | * | ||
| 6 | * Libav is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * Libav is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with Libav; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @file | ||
| 23 | * functions common to libdirac and libschroedinger | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include "libdirac_libschro.h" | ||
| 27 | |||
| 28 | static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = { | ||
| 29 | { 640, 480, 24000, 1001}, | ||
| 30 | { 176, 120, 15000, 1001}, | ||
| 31 | { 176, 144, 25, 2 }, | ||
| 32 | { 352, 240, 15000, 1001}, | ||
| 33 | { 352, 288, 25, 2 }, | ||
| 34 | { 704, 480, 15000, 1001}, | ||
| 35 | { 704, 576, 25, 2 }, | ||
| 36 | { 720, 480, 30000, 1001}, | ||
| 37 | { 720, 576, 25, 1 }, | ||
| 38 | { 1280, 720, 60000, 1001}, | ||
| 39 | { 1280, 720, 50, 1 }, | ||
| 40 | { 1920, 1080, 30000, 1001}, | ||
| 41 | { 1920, 1080, 25, 1 }, | ||
| 42 | { 1920, 1080, 60000, 1001}, | ||
| 43 | { 1920, 1080, 50, 1 }, | ||
| 44 | { 2048, 1080, 24, 1 }, | ||
| 45 | { 4096, 2160, 24, 1 }, | ||
| 46 | }; | ||
| 47 | |||
| 48 | unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext) | ||
| 49 | { | ||
| 50 | unsigned int ret_idx = 0; | ||
| 51 | unsigned int idx; | ||
| 52 | unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) / | ||
| 53 | sizeof(ff_dirac_schro_video_format_info[0]); | ||
| 54 | |||
| 55 | for (idx = 1; idx < num_formats; ++idx) { | ||
| 56 | const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx]; | ||
| 57 | if (avccontext->width == vf->width && | ||
| 58 | avccontext->height == vf->height) { | ||
| 59 | ret_idx = idx; | ||
| 60 | if (avccontext->time_base.den == vf->frame_rate_num && | ||
| 61 | avccontext->time_base.num == vf->frame_rate_denom) | ||
| 62 | return idx; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | return ret_idx; | ||
| 66 | } | ||
| 67 | |||
| 68 | void ff_dirac_schro_queue_init(DiracSchroQueue *queue) | ||
| 69 | { | ||
| 70 | queue->p_head = queue->p_tail = NULL; | ||
| 71 | queue->size = 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | ||
| 75 | void (*free_func)(void *)) | ||
| 76 | { | ||
| 77 | while (queue->p_head) | ||
| 78 | free_func(ff_dirac_schro_queue_pop(queue)); | ||
| 79 | } | ||
| 80 | |||
| 81 | int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data) | ||
| 82 | { | ||
| 83 | DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement)); | ||
| 84 | |||
| 85 | if (!p_new) | ||
| 86 | return -1; | ||
| 87 | |||
| 88 | p_new->data = p_data; | ||
| 89 | |||
| 90 | if (!queue->p_head) | ||
| 91 | queue->p_head = p_new; | ||
| 92 | else | ||
| 93 | queue->p_tail->next = p_new; | ||
| 94 | queue->p_tail = p_new; | ||
| 95 | |||
| 96 | ++queue->size; | ||
| 97 | return 0; | ||
| 98 | } | ||
| 99 | |||
| 100 | void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue) | ||
| 101 | { | ||
| 102 | DiracSchroQueueElement *top = queue->p_head; | ||
| 103 | |||
| 104 | if (top) { | ||
| 105 | void *data = top->data; | ||
| 106 | queue->p_head = queue->p_head->next; | ||
| 107 | --queue->size; | ||
| 108 | av_freep(&top); | ||
| 109 | return data; | ||
| 110 | } | ||
| 111 | |||
| 112 | return NULL; | ||
| 113 | } | ||
| @@ -1,105 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot com > | ||
| 3 | * | ||
| 4 | * This file is part of Libav. | ||
| 5 | * | ||
| 6 | * Libav is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * Libav is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with Libav; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | /** | ||
| 22 | * @file | ||
| 23 | * data structures common to libdirac and libschroedinger | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H | ||
| 27 | #define AVCODEC_LIBDIRAC_LIBSCHRO_H | ||
| 28 | |||
| 29 | #include "avcodec.h" | ||
| 30 | |||
| 31 | typedef struct { | ||
| 32 | uint16_t width; | ||
| 33 | uint16_t height; | ||
| 34 | uint16_t frame_rate_num; | ||
| 35 | uint16_t frame_rate_denom; | ||
| 36 | } DiracSchroVideoFormatInfo; | ||
| 37 | |||
| 38 | /** | ||
| 39 | * Returns the index into the Dirac Schro common video format info table | ||
| 40 | */ | ||
| 41 | unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext); | ||
| 42 | |||
| 43 | /** | ||
| 44 | * contains a single encoded frame returned from Dirac or Schroedinger | ||
| 45 | */ | ||
| 46 | typedef struct DiracSchroEncodedFrame { | ||
| 47 | /** encoded frame data */ | ||
| 48 | uint8_t *p_encbuf; | ||
| 49 | |||
| 50 | /** encoded frame size */ | ||
| 51 | uint32_t size; | ||
| 52 | |||
| 53 | /** encoded frame number. Will be used as pts */ | ||
| 54 | uint32_t frame_num; | ||
| 55 | |||
| 56 | /** key frame flag. 1 : is key frame , 0 : in not key frame */ | ||
| 57 | uint16_t key_frame; | ||
| 58 | } DiracSchroEncodedFrame; | ||
| 59 | |||
| 60 | /** | ||
| 61 | * queue element | ||
| 62 | */ | ||
| 63 | typedef struct DiracSchroQueueElement { | ||
| 64 | /** Data to be stored in queue*/ | ||
| 65 | void *data; | ||
| 66 | /** Pointer to next element queue */ | ||
| 67 | struct DiracSchroQueueElement *next; | ||
| 68 | } DiracSchroQueueElement; | ||
| 69 | |||
| 70 | |||
| 71 | /** | ||
| 72 | * A simple queue implementation used in libdirac and libschroedinger | ||
| 73 | */ | ||
| 74 | typedef struct DiracSchroQueue { | ||
| 75 | /** Pointer to head of queue */ | ||
| 76 | DiracSchroQueueElement *p_head; | ||
| 77 | /** Pointer to tail of queue */ | ||
| 78 | DiracSchroQueueElement *p_tail; | ||
| 79 | /** Queue size*/ | ||
| 80 | int size; | ||
| 81 | } DiracSchroQueue; | ||
| 82 | |||
| 83 | /** | ||
| 84 | * Initialise the queue | ||
| 85 | */ | ||
| 86 | void ff_dirac_schro_queue_init(DiracSchroQueue *queue); | ||
| 87 | |||
| 88 | /** | ||
| 89 | * Add an element to the end of the queue | ||
| 90 | */ | ||
| 91 | int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data); | ||
| 92 | |||
| 93 | /** | ||
| 94 | * Return the first element in the queue | ||
| 95 | */ | ||
| 96 | void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue); | ||
| 97 | |||
| 98 | /** | ||
| 99 | * Free the queue resources. free_func is a function supplied by the caller to | ||
| 100 | * free any resources allocated by the caller. The data field of the queue | ||
| 101 | * element is passed to it. | ||
| 102 | */ | ||
| 103 | void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | ||
| 104 | void (*free_func)(void *)); | ||
| 105 | #endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ | ||
| @@ -23,12 +23,97 @@ · 22 unmodified lines | |||
| 23 | * function definitions common to libschroedinger decoder and encoder | 23 | * function definitions common to libschroedinger decoder and encoder |
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include "libdirac_libschro.h" | ||
| 27 | #include "libschroedinger.h" | 26 | #include "libschroedinger.h" |
| 28 | 27 | ||
| 28 | static const SchroVideoFormatInfo ff_schro_video_format_info[] = { | ||
| 29 | { 640, 480, 24000, 1001}, | ||
| 30 | { 176, 120, 15000, 1001}, | ||
| 31 | { 176, 144, 25, 2 }, | ||
| 32 | { 352, 240, 15000, 1001}, | ||
| 33 | { 352, 288, 25, 2 }, | ||
| 34 | { 704, 480, 15000, 1001}, | ||
| 35 | { 704, 576, 25, 2 }, | ||
| 36 | { 720, 480, 30000, 1001}, | ||
| 37 | { 720, 576, 25, 1 }, | ||
| 38 | { 1280, 720, 60000, 1001}, | ||
| 39 | { 1280, 720, 50, 1 }, | ||
| 40 | { 1920, 1080, 30000, 1001}, | ||
| 41 | { 1920, 1080, 25, 1 }, | ||
| 42 | { 1920, 1080, 60000, 1001}, | ||
| 43 | { 1920, 1080, 50, 1 }, | ||
| 44 | { 2048, 1080, 24, 1 }, | ||
| 45 | { 4096, 2160, 24, 1 }, | ||
| 46 | }; | ||
| 47 | |||
| 48 | static unsigned int get_video_format_idx(AVCodecContext *avccontext) | ||
| 49 | { | ||
| 50 | unsigned int ret_idx = 0; | ||
| 51 | unsigned int idx; | ||
| 52 | unsigned int num_formats = sizeof(ff_schro_video_format_info) / | ||
| 53 | sizeof(ff_schro_video_format_info[0]); | ||
| 54 | |||
| 55 | for (idx = 1; idx < num_formats; ++idx) { | ||
| 56 | const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx]; | ||
| 57 | if (avccontext->width == vf->width && | ||
| 58 | avccontext->height == vf->height) { | ||
| 59 | ret_idx = idx; | ||
| 60 | if (avccontext->time_base.den == vf->frame_rate_num && | ||
| 61 | avccontext->time_base.num == vf->frame_rate_denom) | ||
| 62 | return idx; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | return ret_idx; | ||
| 66 | } | ||
| 67 | |||
| 68 | void ff_schro_queue_init(FFSchroQueue *queue) | ||
| 69 | { | ||
| 70 | queue->p_head = queue->p_tail = NULL; | ||
| 71 | queue->size = 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)) | ||
| 75 | { | ||
| 76 | while (queue->p_head) | ||
| 77 | free_func(ff_schro_queue_pop(queue)); | ||
| 78 | } | ||
| 79 | |||
| 80 | int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data) | ||
| 81 | { | ||
| 82 | FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement)); | ||
| 83 | |||
| 84 | if (!p_new) | ||
| 85 | return -1; | ||
| 86 | |||
| 87 | p_new->data = p_data; | ||
| 88 | |||
| 89 | if (!queue->p_head) | ||
| 90 | queue->p_head = p_new; | ||
| 91 | else | ||
| 92 | queue->p_tail->next = p_new; | ||
| 93 | queue->p_tail = p_new; | ||
| 94 | |||
| 95 | ++queue->size; | ||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | |||
| 99 | void *ff_schro_queue_pop(FFSchroQueue *queue) | ||
| 100 | { | ||
| 101 | FFSchroQueueElement *top = queue->p_head; | ||
| 102 | |||
| 103 | if (top) { | ||
| 104 | void *data = top->data; | ||
| 105 | queue->p_head = queue->p_head->next; | ||
| 106 | --queue->size; | ||
| 107 | av_freep(&top); | ||
| 108 | return data; | ||
| 109 | } | ||
| 110 | |||
| 111 | return NULL; | ||
| 112 | } | ||
| 113 | |||
| 29 | /** | 114 | /** |
| 30 | * Schroedinger video preset table. Ensure that this tables matches up correctly | 115 | * Schroedinger video preset table. Ensure that this tables matches up correctly |
| 31 | * with the ff_dirac_schro_video_format_info table in libdirac_libschro.c. | 116 | * with the ff_schro_video_format_info table. |
| 32 | */ | 117 | */ |
| 33 | static const SchroVideoFormatEnum ff_schro_video_formats[]={ | 118 | static const SchroVideoFormatEnum ff_schro_video_formats[]={ |
| 34 | SCHRO_VIDEO_FORMAT_CUSTOM , | 119 | SCHRO_VIDEO_FORMAT_CUSTOM , |
| @@ -55,7 +140,7 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext · 20 unmodified lines | |||
| 55 | unsigned int num_formats = sizeof(ff_schro_video_formats) / | 140 | unsigned int num_formats = sizeof(ff_schro_video_formats) / |
| 56 | sizeof(ff_schro_video_formats[0]); | 141 | sizeof(ff_schro_video_formats[0]); |
| 57 | 142 | ||
| 58 | unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext); | 143 | unsigned int idx = get_video_format_idx(avccontext); |
| 59 | 144 | ||
| 60 | return (idx < num_formats) ? ff_schro_video_formats[idx] : | 145 | return (idx < num_formats) ? ff_schro_video_formats[idx] : |
| 61 | SCHRO_VIDEO_FORMAT_CUSTOM; | 146 | SCHRO_VIDEO_FORMAT_CUSTOM; |
| @@ -28,8 +28,78 @@ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | #include <schroedinger/schrobitstream.h> | 29 | #include <schroedinger/schrobitstream.h> |
| 30 | #include <schroedinger/schroframe.h> | 30 | #include <schroedinger/schroframe.h> |
| 31 | |||
| 31 | #include "avcodec.h" | 32 | #include "avcodec.h" |
| 32 | 33 | ||
| 34 | typedef struct { | ||
| 35 | uint16_t width; | ||
| 36 | uint16_t height; | ||
| 37 | uint16_t frame_rate_num; | ||
| 38 | uint16_t frame_rate_denom; | ||
| 39 | } SchroVideoFormatInfo; | ||
| 40 | |||
| 41 | /** | ||
| 42 | * contains a single encoded frame returned from Dirac or Schroedinger | ||
| 43 | */ | ||
| 44 | typedef struct FFSchroEncodedFrame { | ||
| 45 | /** encoded frame data */ | ||
| 46 | uint8_t *p_encbuf; | ||
| 47 | |||
| 48 | /** encoded frame size */ | ||
| 49 | uint32_t size; | ||
| 50 | |||
| 51 | /** encoded frame number. Will be used as pts */ | ||
| 52 | uint32_t frame_num; | ||
| 53 | |||
| 54 | /** key frame flag. 1 : is key frame , 0 : in not key frame */ | ||
| 55 | uint16_t key_frame; | ||
| 56 | } FFSchroEncodedFrame; | ||
| 57 | |||
| 58 | /** | ||
| 59 | * queue element | ||
| 60 | */ | ||
| 61 | typedef struct FFSchroQueueElement { | ||
| 62 | /** Data to be stored in queue*/ | ||
| 63 | void *data; | ||
| 64 | /** Pointer to next element queue */ | ||
| 65 | struct FFSchroQueueElement *next; | ||
| 66 | } FFSchroQueueElement; | ||
| 67 | |||
| 68 | |||
| 69 | /** | ||
| 70 | * A simple queue implementation used in libschroedinger | ||
| 71 | */ | ||
| 72 | typedef struct FFSchroQueue { | ||
| 73 | /** Pointer to head of queue */ | ||
| 74 | FFSchroQueueElement *p_head; | ||
| 75 | /** Pointer to tail of queue */ | ||
| 76 | FFSchroQueueElement *p_tail; | ||
| 77 | /** Queue size*/ | ||
| 78 | int size; | ||
| 79 | } FFSchroQueue; | ||
| 80 | |||
| 81 | /** | ||
| 82 | * Initialise the queue | ||
| 83 | */ | ||
| 84 | void ff_schro_queue_init(FFSchroQueue *queue); | ||
| 85 | |||
| 86 | /** | ||
| 87 | * Add an element to the end of the queue | ||
| 88 | */ | ||
| 89 | int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data); | ||
| 90 | |||
| 91 | /** | ||
| 92 | * Return the first element in the queue | ||
| 93 | */ | ||
| 94 | void *ff_schro_queue_pop(FFSchroQueue *queue); | ||
| 95 | |||
| 96 | /** | ||
| 97 | * Free the queue resources. free_func is a function supplied by the caller to | ||
| 98 | * free any resources allocated by the caller. The data field of the queue | ||
| 99 | * element is passed to it. | ||
| 100 | */ | ||
| 101 | void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)); | ||
| 102 | |||
| 33 | static const struct { | 103 | static const struct { |
| 34 | enum PixelFormat ff_pix_fmt; | 104 | enum PixelFormat ff_pix_fmt; |
| 35 | SchroChromaFormat schro_pix_fmt; | 105 | SchroChromaFormat schro_pix_fmt; |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #include "libavutil/imgutils.h" | 30 | #include "libavutil/imgutils.h" |
| 31 | #include "avcodec.h" | 31 | #include "avcodec.h" |
| 32 | #include "libdirac_libschro.h" | ||
| 33 | #include "libschroedinger.h" | 32 | #include "libschroedinger.h" |
| 34 | 33 | ||
| 35 | #undef NDEBUG | 34 | #undef NDEBUG |
| @@ -52,7 +51,7 @@ typedef struct SchroDecoderParams { · 16 unmodified lines | |||
| 52 | SchroDecoder* decoder; | 51 | SchroDecoder* decoder; |
| 53 | 52 | ||
| 54 | /** queue storing decoded frames */ | 53 | /** queue storing decoded frames */ |
| 55 | DiracSchroQueue dec_frame_queue; | 54 | FFSchroQueue dec_frame_queue; |
| 56 | 55 | ||
| 57 | /** end of sequence signalled */ | 56 | /** end of sequence signalled */ |
| 58 | int eos_signalled; | 57 | int eos_signalled; |
| @@ -155,7 +154,7 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) · 96 unmodified lines | |||
| 155 | return -1; | 154 | return -1; |
| 156 | 155 | ||
| 157 | /* Initialize the decoded frame queue. */ | 156 | /* Initialize the decoded frame queue. */ |
| 158 | ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | 157 | ff_schro_queue_init(&p_schro_params->dec_frame_queue); |
| 159 | return 0; | 158 | return 0; |
| 160 | } | 159 | } |
| 161 | 160 | ||
| @@ -267,8 +266,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 105 unmodified lines | |||
| 267 | frame = schro_decoder_pull(decoder); | 266 | frame = schro_decoder_pull(decoder); |
| 268 | 267 | ||
| 269 | if (frame) | 268 | if (frame) |
| 270 | ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue, | 269 | ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, |
| 271 | frame); | 270 | frame); |
| 272 | break; | 271 | break; |
| 273 | case SCHRO_DECODER_EOS: | 272 | case SCHRO_DECODER_EOS: |
| 274 | go = 0; | 273 | go = 0; |
| @@ -285,7 +284,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, · 10 unmodified lines | |||
| 285 | } while (outer); | 284 | } while (outer); |
| 286 | 285 | ||
| 287 | /* Grab next frame to be returned from the top of the queue. */ | 286 | /* Grab next frame to be returned from the top of the queue. */ |
| 288 | frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue); | 287 | frame = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); |
| 289 | 288 | ||
| 290 | if (frame) { | 289 | if (frame) { |
| 291 | memcpy(p_schro_params->dec_pic.data[0], | 290 | memcpy(p_schro_params->dec_pic.data[0], |
| @@ -324,8 +323,8 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext) · 32 unmodified lines | |||
| 324 | avpicture_free(&p_schro_params->dec_pic); | 323 | avpicture_free(&p_schro_params->dec_pic); |
| 325 | 324 | ||
| 326 | /* Free data in the output frame queue. */ | 325 | /* Free data in the output frame queue. */ |
| 327 | ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | 326 | ff_schro_queue_free(&p_schro_params->dec_frame_queue, |
| 328 | libschroedinger_decode_frame_free); | 327 | libschroedinger_decode_frame_free); |
| 329 | 328 | ||
| 330 | return 0; | 329 | return 0; |
| 331 | } | 330 | } |
| @@ -337,10 +336,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext) · 5 unmodified lines | |||
| 337 | SchroDecoderParams *p_schro_params = avccontext->priv_data; | 336 | SchroDecoderParams *p_schro_params = avccontext->priv_data; |
| 338 | 337 | ||
| 339 | /* Free data in the output frame queue. */ | 338 | /* Free data in the output frame queue. */ |
| 340 | ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | 339 | ff_schro_queue_free(&p_schro_params->dec_frame_queue, |
| 341 | libschroedinger_decode_frame_free); | 340 | libschroedinger_decode_frame_free); |
| 342 | 341 | ||
| 343 | ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | 342 | ff_schro_queue_init(&p_schro_params->dec_frame_queue); |
| 344 | schro_decoder_reset(p_schro_params->decoder); | 343 | schro_decoder_reset(p_schro_params->decoder); |
| 345 | p_schro_params->eos_pulled = 0; | 344 | p_schro_params->eos_pulled = 0; |
| 346 | p_schro_params->eos_signalled = 0; | 345 | p_schro_params->eos_signalled = 0; |
| @@ -36,7 +36,6 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | #include "avcodec.h" | 37 | #include "avcodec.h" |
| 38 | #include "internal.h" | 38 | #include "internal.h" |
| 39 | #include "libdirac_libschro.h" | ||
| 40 | #include "libschroedinger.h" | 39 | #include "libschroedinger.h" |
| 41 | #include "bytestream.h" | 40 | #include "bytestream.h" |
| 42 | 41 | ||
| @@ -65,7 +64,7 @@ typedef struct SchroEncoderParams { · 22 unmodified lines | |||
| 65 | int enc_buf_size; | 64 | int enc_buf_size; |
| 66 | 65 | ||
| 67 | /** queue storing encoded frames */ | 66 | /** queue storing encoded frames */ |
| 68 | DiracSchroQueue enc_frame_queue; | 67 | FFSchroQueue enc_frame_queue; |
| 69 | 68 | ||
| 70 | /** end of sequence signalled */ | 69 | /** end of sequence signalled */ |
| 71 | int eos_signalled; | 70 | int eos_signalled; |
| @@ -236,7 +235,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) · 164 unmodified lines | |||
| 236 | schro_encoder_start(p_schro_params->encoder); | 235 | schro_encoder_start(p_schro_params->encoder); |
| 237 | 236 | ||
| 238 | /* Initialize the encoded frame queue. */ | 237 | /* Initialize the encoded frame queue. */ |
| 239 | ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue); | 238 | ff_schro_queue_init(&p_schro_params->enc_frame_queue); |
| 240 | return 0; | 239 | return 0; |
| 241 | } | 240 | } |
| 242 | 241 | ||
| @@ -261,7 +260,7 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, · 18 unmodified lines | |||
| 261 | 260 | ||
| 262 | static void SchroedingerFreeFrame(void *data) | 261 | static void SchroedingerFreeFrame(void *data) |
| 263 | { | 262 | { |
| 264 | DiracSchroEncodedFrame *enc_frame = data; | 263 | FFSchroEncodedFrame *enc_frame = data; |
| 265 | 264 | ||
| 266 | av_freep(&enc_frame->p_encbuf); | 265 | av_freep(&enc_frame->p_encbuf); |
| 267 | av_free(enc_frame); | 266 | av_free(enc_frame); |
| @@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 5 unmodified lines | |||
| 273 | int enc_size = 0; | 272 | int enc_size = 0; |
| 274 | SchroEncoderParams *p_schro_params = avccontext->priv_data; | 273 | SchroEncoderParams *p_schro_params = avccontext->priv_data; |
| 275 | SchroEncoder *encoder = p_schro_params->encoder; | 274 | SchroEncoder *encoder = p_schro_params->encoder; |
| 276 | struct DiracSchroEncodedFrame *p_frame_output = NULL; | 275 | struct FFSchroEncodedFrame *p_frame_output = NULL; |
| 277 | int go = 1; | 276 | int go = 1; |
| 278 | SchroBuffer *enc_buf; | 277 | SchroBuffer *enc_buf; |
| 279 | int presentation_frame; | 278 | int presentation_frame; |
| @@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 53 unmodified lines | |||
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | /* Create output frame. */ | 334 | /* Create output frame. */ |
| 336 | p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame)); | 335 | p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame)); |
| 337 | /* Set output data. */ | 336 | /* Set output data. */ |
| 338 | p_frame_output->size = p_schro_params->enc_buf_size; | 337 | p_frame_output->size = p_schro_params->enc_buf_size; |
| 339 | p_frame_output->p_encbuf = p_schro_params->enc_buf; | 338 | p_frame_output->p_encbuf = p_schro_params->enc_buf; |
| @@ -345,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 5 unmodified lines | |||
| 345 | * through 17 represesent the frame number. */ | 344 | * through 17 represesent the frame number. */ |
| 346 | p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); | 345 | p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); |
| 347 | 346 | ||
| 348 | ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue, | 347 | ff_schro_queue_push_back(&p_schro_params->enc_frame_queue, |
| 349 | p_frame_output); | 348 | p_frame_output); |
| 350 | p_schro_params->enc_buf_size = 0; | 349 | p_schro_params->enc_buf_size = 0; |
| 351 | p_schro_params->enc_buf = NULL; | 350 | p_schro_params->enc_buf = NULL; |
| 352 | 351 | ||
| @@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk · 20 unmodified lines | |||
| 373 | p_schro_params->eos_pulled) | 372 | p_schro_params->eos_pulled) |
| 374 | last_frame_in_sequence = 1; | 373 | last_frame_in_sequence = 1; |
| 375 | 374 | ||
| 376 | p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue); | 375 | p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue); |
| 377 | 376 | ||
| 378 | if (!p_frame_output) | 377 | if (!p_frame_output) |
| 379 | return 0; | 378 | return 0; |
| @@ -425,8 +424,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) · 45 unmodified lines | |||
| 425 | schro_encoder_free(p_schro_params->encoder); | 424 | schro_encoder_free(p_schro_params->encoder); |
| 426 | 425 | ||
| 427 | /* Free data in the output frame queue. */ | 426 | /* Free data in the output frame queue. */ |
| 428 | ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue, | 427 | ff_schro_queue_free(&p_schro_params->enc_frame_queue, |
| 429 | SchroedingerFreeFrame); | 428 | SchroedingerFreeFrame); |
| 430 | 429 | ||
| 431 | 430 | ||
| 432 | /* Free the encoder buffer. */ | 431 | /* Free the encoder buffer. */ |