* qatar/master:
ac3dec: fix processing of delta bit allocation information.
vc1: fix fate-vc1 after previous commit.
wmv3dec: fix playback of complex WMV3 files using simple_idct.
make av_dup_packet() more cautious on allocation failures
make containers pass palette change in AVPacket
introduce side information for AVPacket
Politic commits that have not been pulled:
Update regtest checksums after revision 6001dad.
Replace more FFmpeg references by Libav.
Replace references to ffmpeg-devel with libav-devel; fix roundup URL.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.8
| @@ -15,7 +15,7 @@ be properly added to the respective issue. | |||
| The subscription URL for the ffmpeg-issues list is: | |||
| http://live.polito/mailman/listinfo/ffmpeg-issues | |||
| The URL of the webinterface of the tracker is: | |||
| http(s)://roundup.ffmpeg/roundup/ffmpeg/ | |||
| http(s)://roundup.libav.org/ | |||
| Note the URLs in this document are obfuscated, you must append the top level | |||
| domain for non-profit organizations to the tracker, and of Italy to the | |||
| mailing list. | |||
| @@ -187,7 +187,7 @@ feature_request/closed/wont_implement | |||
| be legal, philosophical or others. | |||
| Note, please do not use type-status-substatus combinations other than the | |||
| above without asking on ffmpeg-dev first! | |||
| above without asking on libav-devel first! | |||
| Note2, if you provide the requested info do not forget to remove the | |||
| needs_more_info substate. | |||
| @@ -173,7 +173,7 @@ Set the first PID for data packets (default 0x0100, max 0x0f00). | |||
| The recognized metadata settings in mpegts muxer are @code{service_provider} | |||
| and @code{service_name}. If they are not set the default for | |||
| @code{service_provider} is "FFmpeg" and the default for | |||
| @code{service_provider} is "Libav" and the default for | |||
| @code{service_name} is "Service01". | |||
| @example | |||
| @@ -50,6 +50,8 @@ typedef struct EightBpsContext { | |||
| unsigned char planes; | |||
| unsigned char planemap[4]; | |||
| uint32_t pal[256]; | |||
| } EightBpsContext; | |||
| @@ -129,13 +131,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac | |||
| } | |||
| } | |||
| if (avctx->palctrl) { | |||
| memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (avctx->palctrl->palette_changed) { | |||
| if (avctx->bits_per_coded_sample <= 8) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, | |||
| AV_PKT_DATA_PALETTE, | |||
| NULL); | |||
| if (pal) { | |||
| c->pic.palette_has_changed = 1; | |||
| avctx->palctrl->palette_changed = 0; | |||
| } else | |||
| c->pic.palette_has_changed = 0; | |||
| memcpy(c->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE); | |||
| } | |||
| *data_size = sizeof(AVFrame); | |||
| @@ -164,10 +169,6 @@ static av_cold int decode_init(AVCodecContext *avctx) | |||
| avctx->pix_fmt = PIX_FMT_PAL8; | |||
| c->planes = 1; | |||
| c->planemap[0] = 0; // 1st plane is palette indexes | |||
| if (avctx->palctrl == NULL) { | |||
| av_log(avctx, AV_LOG_ERROR, "Error: PAL8 format but no palette from demuxer.\n"); | |||
| return -1; | |||
| } | |||
| break; | |||
| case 24: | |||
| avctx->pix_fmt = avctx->get_format(avctx, pixfmt_rgb24); | |||
| @@ -192,9 +192,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, | |||
| if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { | |||
| int i, seg, delta; | |||
| if (dba_nsegs >= 8) | |||
| if (dba_nsegs > 8) | |||
| return -1; | |||
| band = 0; | |||
| band = band_start; | |||
| for (seg = 0; seg < dba_nsegs; seg++) { | |||
| band += dba_offsets[seg]; | |||
| if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band) | |||
| @@ -1175,8 +1175,8 @@ static int decode_audio_block(AC3DecodeContext *s, int blk) | |||
| /* channel delta offset, len and bit allocation */ | |||
| for (ch = !cpl_in_use; ch <= fbw_channels; ch++) { | |||
| if (s->dba_mode[ch] == DBA_NEW) { | |||
| s->dba_nsegs[ch] = get_bits(gbc, 3); | |||
| for (seg = 0; seg <= s->dba_nsegs[ch]; seg++) { | |||
| s->dba_nsegs[ch] = get_bits(gbc, 3) + 1; | |||
| for (seg = 0; seg < s->dba_nsegs[ch]; seg++) { | |||
| s->dba_offsets[ch][seg] = get_bits(gbc, 5); | |||
| s->dba_lengths[ch][seg] = get_bits(gbc, 4); | |||
| s->dba_values[ch][seg] = get_bits(gbc, 3); | |||
| @@ -1046,6 +1046,10 @@ typedef struct AVPanScan{ | |||
| #define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. | |||
| #define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). | |||
| enum AVPacketSideDataType { | |||
| AV_PKT_DATA_PALETTE, | |||
| }; | |||
| typedef struct AVPacket { | |||
| /** | |||
| * Presentation timestamp in AVStream->time_base units; the time at which | |||
| @@ -1067,6 +1071,17 @@ typedef struct AVPacket { | |||
| int size; | |||
| int stream_index; | |||
| int flags; | |||
| /** | |||
| * Additional packet data that can be provided by the container. | |||
| * Packet can contain several types of side information. | |||
| */ | |||
| struct { | |||
| uint8_t *data; | |||
| int size; | |||
| enum AVPacketSideDataType type; | |||
| } *side_data; | |||
| int side_data_elems; | |||
| /** | |||
| * Duration of this packet in AVStream->time_base units, 0 if unknown. | |||
| * Equals next_pts - this_pts in presentation order. | |||
| @@ -3224,6 +3239,28 @@ int av_dup_packet(AVPacket *pkt); | |||
| */ | |||
| void av_free_packet(AVPacket *pkt); | |||
| /** | |||
| * Allocate new information of a packet. | |||
| * | |||
| * @param pkt packet | |||
| * @param type side information type | |||
| * @param size side information size | |||
| * @return pointer to fresh allocated data or NULL otherwise | |||
| */ | |||
| uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, | |||
| int size); | |||
| /** | |||
| * Get side information from packet. | |||
| * | |||
| * @param pkt packet | |||
| * @param type desired side information type | |||
| * @param size pointer for side information size to store (optional) | |||
| * @return pointer to data if present or NULL otherwise | |||
| */ | |||
| uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, | |||
| int *size); | |||
| /* resample.c */ | |||
| struct ReSampleContext; | |||
| @@ -26,12 +26,21 @@ | |||
| void av_destruct_packet_nofree(AVPacket *pkt) | |||
| { | |||
| pkt->data = NULL; pkt->size = 0; | |||
| pkt->side_data = NULL; | |||
| pkt->side_data_elems = 0; | |||
| } | |||
| void av_destruct_packet(AVPacket *pkt) | |||
| { | |||
| int i; | |||
| av_free(pkt->data); | |||
| pkt->data = NULL; pkt->size = 0; | |||
| for (i = 0; i < pkt->side_data_elems; i++) | |||
| av_free(pkt->side_data[i].data); | |||
| av_freep(&pkt->side_data); | |||
| pkt->side_data_elems = 0; | |||
| } | |||
| void av_init_packet(AVPacket *pkt) | |||
| @@ -44,6 +53,8 @@ void av_init_packet(AVPacket *pkt) | |||
| pkt->flags = 0; | |||
| pkt->stream_index = 0; | |||
| pkt->destruct= NULL; | |||
| pkt->side_data = NULL; | |||
| pkt->side_data_elems = 0; | |||
| } | |||
| int av_new_packet(AVPacket *pkt, int size) | |||
| @@ -89,23 +100,52 @@ int av_grow_packet(AVPacket *pkt, int grow_by) | |||
| return 0; | |||
| } | |||
| #define DUP_DATA(dst, src, size, padding) \ | |||
| do { \ | |||
| void *data; \ | |||
| if (padding) { \ | |||
| if ((unsigned)(size) > (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \ | |||
| goto failed_alloc; \ | |||
| data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); \ | |||
| } else { \ | |||
| data = av_malloc(size); \ | |||
| } \ | |||
| if (!data) \ | |||
| goto failed_alloc; \ | |||
| memcpy(data, src, size); \ | |||
| if (padding) \ | |||
| memset((uint8_t*)data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); \ | |||
| dst = data; \ | |||
| } while(0) | |||
| int av_dup_packet(AVPacket *pkt) | |||
| { | |||
| AVPacket tmp_pkt; | |||
| if (((pkt->destruct == av_destruct_packet_nofree) || (pkt->destruct == NULL)) && pkt->data) { | |||
| uint8_t *data; | |||
| /* We duplicate the packet and don't forget to add the padding again. */ | |||
| if((unsigned)pkt->size > (unsigned)pkt->size + FF_INPUT_BUFFER_PADDING_SIZE) | |||
| return AVERROR(ENOMEM); | |||
| data = av_malloc(pkt->size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| if (!data) { | |||
| return AVERROR(ENOMEM); | |||
| } | |||
| memcpy(data, pkt->data, pkt->size); | |||
| memset(data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); | |||
| pkt->data = data; | |||
| tmp_pkt = *pkt; | |||
| pkt->data = NULL; | |||
| pkt->side_data = NULL; | |||
| DUP_DATA(pkt->data, tmp_pkt.data, pkt->size, 1); | |||
| pkt->destruct = av_destruct_packet; | |||
| if (pkt->side_data_elems) { | |||
| int i; | |||
| DUP_DATA(pkt->side_data, tmp_pkt.side_data, | |||
| pkt->side_data_elems * sizeof(*pkt->side_data), 0); | |||
| memset(pkt->side_data, 0, pkt->side_data_elems * sizeof(*pkt->side_data)); | |||
| for (i = 0; i < pkt->side_data_elems; i++) { | |||
| DUP_DATA(pkt->side_data[i].data, tmp_pkt.side_data[i].data, | |||
| pkt->side_data[i].size, 1); | |||
| } | |||
| } | |||
| } | |||
| return 0; | |||
| failed_alloc: | |||
| av_destruct_packet(pkt); | |||
| return AVERROR(ENOMEM); | |||
| } | |||
| void av_free_packet(AVPacket *pkt) | |||
| @@ -113,5 +153,46 @@ void av_free_packet(AVPacket *pkt) | |||
| if (pkt) { | |||
| if (pkt->destruct) pkt->destruct(pkt); | |||
| pkt->data = NULL; pkt->size = 0; | |||
| pkt->side_data = NULL; | |||
| pkt->side_data_elems = 0; | |||
| } | |||
| } | |||
| uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, | |||
| int size) | |||
| { | |||
| int elems = pkt->side_data_elems; | |||
| if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) | |||
| return NULL; | |||
| if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) | |||
| return NULL; | |||
| pkt->side_data = av_realloc(pkt->side_data, (elems + 1) * sizeof(*pkt->side_data)); | |||
| if (!pkt->side_data) | |||
| return NULL; | |||
| pkt->side_data[elems].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| if (!pkt->side_data[elems].data) | |||
| return NULL; | |||
| pkt->side_data[elems].size = size; | |||
| pkt->side_data[elems].type = type; | |||
| pkt->side_data_elems++; | |||
| return pkt->side_data[elems].data; | |||
| } | |||
| uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, | |||
| int *size) | |||
| { | |||
| int i; | |||
| for (i = 0; i < pkt->side_data_elems; i++) { | |||
| if (pkt->side_data[i].type == type) { | |||
| if (size) | |||
| *size = pkt->side_data[i].size; | |||
| return pkt->side_data[i].data; | |||
| } | |||
| } | |||
| return NULL; | |||
| } | |||
| @@ -67,6 +67,7 @@ typedef struct CinepakContext { | |||
| int sega_film_skip_bytes; | |||
| uint32_t pal[256]; | |||
| } CinepakContext; | |||
| static void cinepak_decode_codebook (cvid_codebook *codebook, | |||
| @@ -395,7 +396,7 @@ static av_cold int cinepak_decode_init(AVCodecContext *avctx) | |||
| s->sega_film_skip_bytes = -1; /* uninitialized state */ | |||
| // check for paletted data | |||
| if ((avctx->palctrl == NULL) || (avctx->bits_per_coded_sample == 40)) { | |||
| if (avctx->bits_per_coded_sample != 8) { | |||
| s->palette_video = 0; | |||
| avctx->pix_fmt = PIX_FMT_YUV420P; | |||
| } else { | |||
| @@ -427,17 +428,19 @@ static int cinepak_decode_frame(AVCodecContext *avctx, | |||
| return -1; | |||
| } | |||
| cinepak_decode(s); | |||
| if (s->palette_video) { | |||
| memcpy (s->frame.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (avctx->palctrl->palette_changed) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| s->frame.palette_has_changed = 1; | |||
| avctx->palctrl->palette_changed = 0; | |||
| } else | |||
| s->frame.palette_has_changed = 0; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| } | |||
| cinepak_decode(s); | |||
| if (s->palette_video) | |||
| memcpy (s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| *data_size = sizeof(AVFrame); | |||
| *(AVFrame*)data = s->frame; | |||
| @@ -2844,7 +2844,7 @@ int ff_check_alignment(void){ | |||
| "Compiler did not align stack variables. Libavcodec has been miscompiled\n" | |||
| "and may be very slow or crash. This is not a bug in libavcodec,\n" | |||
| "but in the compiler. You may try recompiling using gcc >= 4.2.\n" | |||
| "Do not report crashes to FFmpeg developers.\n"); | |||
| "Do not report crashes to Libav developers.\n"); | |||
| #endif | |||
| did_fail=1; | |||
| } | |||
| @@ -787,7 +787,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i | |||
| method suggested in SMPTE 314M Table 22, and an improved | |||
| method. The SMPTE method is very conservative; it assigns class | |||
| 3 (i.e. severe quantization) to any block where the largest AC | |||
| component is greater than 36. FFmpeg's DV encoder tracks AC bit | |||
| component is greater than 36. Libav's DV encoder tracks AC bit | |||
| consumption precisely, so there is no need to bias most blocks | |||
| towards strongly lossy compression. Instead, we assign class 2 | |||
| to most blocks, and use class 3 only when strictly necessary | |||
| @@ -795,7 +795,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i | |||
| #if 0 /* SMPTE spec method */ | |||
| static const int classes[] = {12, 24, 36, 0xffff}; | |||
| #else /* improved FFmpeg method */ | |||
| #else /* improved Libav method */ | |||
| static const int classes[] = {-1, -1, 255, 0xffff}; | |||
| #endif | |||
| int max = classes[0]; | |||
| @@ -60,7 +60,7 @@ struct dxva_context { | |||
| uint64_t workaround; | |||
| /** | |||
| * Private to the FFmpeg AVHWAccel implementation | |||
| * Private to the Libav AVHWAccel implementation | |||
| */ | |||
| unsigned report_id; | |||
| }; | |||
| @@ -95,7 +95,7 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context | |||
| pp->wBitFields = ((s->picture_structure != PICT_FRAME) << 0) | | |||
| (h->sps.mb_aff << 1) | | |||
| (h->sps.residual_color_transform_flag << 2) | | |||
| /* sp_for_switch_flag (not implemented by FFmpeg) */ | |||
| /* sp_for_switch_flag (not implemented by Libav) */ | |||
| (0 << 3) | | |||
| (h->sps.chroma_format_idc << 4) | | |||
| ((h->nal_ref_idc != 0) << 6) | | |||
| @@ -146,8 +146,8 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context | |||
| pp->deblocking_filter_control_present_flag = h->pps.deblocking_filter_parameters_present; | |||
| pp->redundant_pic_cnt_present_flag= h->pps.redundant_pic_cnt_present; | |||
| pp->Reserved8BitsB = 0; | |||
| pp->slice_group_change_rate_minus1= 0; /* XXX not implemented by FFmpeg */ | |||
| //pp->SliceGroupMap[810]; /* XXX not implemented by FFmpeg */ | |||
| pp->slice_group_change_rate_minus1= 0; /* XXX not implemented by Libav */ | |||
| //pp->SliceGroupMap[810]; /* XXX not implemented by Libav */ | |||
| } | |||
| static void fill_scaling_lists(const H264Context *h, DXVA_Qmatrix_H264 *qm) | |||
| @@ -243,7 +243,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, | |||
| } | |||
| } | |||
| } | |||
| slice->slice_qs_delta = 0; /* XXX not implemented by FFmpeg */ | |||
| slice->slice_qs_delta = 0; /* XXX not implemented by Libav */ | |||
| slice->slice_qp_delta = s->qscale - h->pps.init_qp; | |||
| slice->redundant_pic_cnt = h->redundant_pic_count; | |||
| if (h->slice_type == FF_B_TYPE) | |||
| @@ -72,6 +72,7 @@ typedef struct IdcinContext { | |||
| hnode huff_nodes[256][HUF_TOKENS*2]; | |||
| int num_huff_nodes[256]; | |||
| uint32_t pal[256]; | |||
| } IdcinContext; | |||
| /* | |||
| @@ -213,7 +214,7 @@ static int idcin_decode_frame(AVCodecContext *avctx, | |||
| const uint8_t *buf = avpkt->data; | |||
| int buf_size = avpkt->size; | |||
| IdcinContext *s = avctx->priv_data; | |||
| AVPaletteControl *palette_control = avctx->palctrl; | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| s->buf = buf; | |||
| s->size = buf_size; | |||
| @@ -228,13 +229,12 @@ static int idcin_decode_frame(AVCodecContext *avctx, | |||
| idcin_decode_vlcs(s); | |||
| /* make the palette available on the way out */ | |||
| memcpy(s->frame.data[1], palette_control->palette, PALETTE_COUNT * 4); | |||
| /* If palette changed inform application*/ | |||
| if (palette_control->palette_changed) { | |||
| palette_control->palette_changed = 0; | |||
| if (pal) { | |||
| s->frame.palette_has_changed = 1; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| /* make the palette available on the way out */ | |||
| memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| *data_size = sizeof(AVFrame); | |||
| *(AVFrame*)data = s->frame; | |||
| @@ -77,6 +77,7 @@ typedef struct IpvideoContext { | |||
| int stride; | |||
| int upper_motion_limit_offset; | |||
| uint32_t pal[256]; | |||
| } IpvideoContext; | |||
| #define CHECK_STREAM_PTR(stream_ptr, stream_end, n) \ | |||
| @@ -969,7 +970,7 @@ static void ipvideo_decode_opcodes(IpvideoContext *s) | |||
| if (!s->is_16bpp) { | |||
| /* this is PAL8, so make the palette available */ | |||
| memcpy(s->current_frame.data[1], s->avctx->palctrl->palette, PALETTE_COUNT * 4); | |||
| memcpy(s->current_frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| s->stride = s->current_frame.linesize[0]; | |||
| s->stream_ptr = s->buf + 14; /* data starts 14 bytes in */ | |||
| @@ -1023,10 +1024,6 @@ static av_cold int ipvideo_decode_init(AVCodecContext *avctx) | |||
| s->is_16bpp = avctx->bits_per_coded_sample == 16; | |||
| avctx->pix_fmt = s->is_16bpp ? PIX_FMT_RGB555 : PIX_FMT_PAL8; | |||
| if (!s->is_16bpp && s->avctx->palctrl == NULL) { | |||
| av_log(avctx, AV_LOG_ERROR, " Interplay video: palette expected.\n"); | |||
| return -1; | |||
| } | |||
| dsputil_init(&s->dsp, avctx); | |||
| @@ -1046,7 +1043,6 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, | |||
| const uint8_t *buf = avpkt->data; | |||
| int buf_size = avpkt->size; | |||
| IpvideoContext *s = avctx->priv_data; | |||
| AVPaletteControl *palette_control = avctx->palctrl; | |||
| /* compressed buffer needs to be large enough to at least hold an entire | |||
| * decoding map */ | |||
| @@ -1063,13 +1059,16 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, | |||
| return -1; | |||
| } | |||
| ipvideo_decode_opcodes(s); | |||
| if (!s->is_16bpp && palette_control->palette_changed) { | |||
| palette_control->palette_changed = 0; | |||
| s->current_frame.palette_has_changed = 1; | |||
| if (!s->is_16bpp) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| s->current_frame.palette_has_changed = 1; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| } | |||
| ipvideo_decode_opcodes(s); | |||
| *data_size = sizeof(AVFrame); | |||
| *(AVFrame*)data = s->current_frame; | |||
| @@ -40,7 +40,7 @@ | |||
| * (or test broken JPEG-LS decoder) and slow down ordinary decoding a bit. | |||
| * | |||
| * There is no Golomb code with length >= 32 bits possible, so check and | |||
| * avoid situation of 32 zeros, FFmpeg Golomb decoder is painfully slow | |||
| * avoid situation of 32 zeros, Libav Golomb decoder is painfully slow | |||
| * on this errors. | |||
| */ | |||
| //#define JLS_BROKEN | |||
| @@ -233,6 +233,7 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa | |||
| int i; | |||
| int header; | |||
| int blocksize; | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (ctx->pic.data[0]) | |||
| avctx->release_buffer(avctx, &ctx->pic); | |||
| @@ -264,13 +265,6 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa | |||
| ctx->pic.pict_type = FF_P_TYPE; | |||
| } | |||
| /* if palette has been changed, copy it from palctrl */ | |||
| if (ctx->avctx->palctrl && ctx->avctx->palctrl->palette_changed) { | |||
| memcpy(ctx->pal, ctx->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| ctx->setpal = 1; | |||
| ctx->avctx->palctrl->palette_changed = 0; | |||
| } | |||
| if (header & KMVC_PALETTE) { | |||
| ctx->pic.palette_has_changed = 1; | |||
| // palette starts from index 1 and has 127 entries | |||
| @@ -279,6 +273,11 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPa | |||
| } | |||
| } | |||
| if (pal) { | |||
| ctx->pic.palette_has_changed = 1; | |||
| memcpy(ctx->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| if (ctx->setpal) { | |||
| ctx->setpal = 0; | |||
| ctx->pic.palette_has_changed = 1; | |||
| @@ -374,9 +373,6 @@ static av_cold int decode_init(AVCodecContext * avctx) | |||
| src += 4; | |||
| } | |||
| c->setpal = 1; | |||
| if (c->avctx->palctrl) { | |||
| c->avctx->palctrl->palette_changed = 0; | |||
| } | |||
| } | |||
| avctx->pix_fmt = PIX_FMT_PAL8; | |||
| @@ -30,7 +30,7 @@ | |||
| #include <libdirac_common/dirac_types.h> | |||
| /** | |||
| * Table providing a Dirac chroma format to FFmpeg pixel format mapping. | |||
| * Table providing a Dirac chroma format to Libav pixel format mapping. | |||
| */ | |||
| static const struct { | |||
| enum PixelFormat ff_pix_fmt; | |||
| @@ -47,7 +47,7 @@ typedef struct FfmpegDiracDecoderParams { | |||
| /** | |||
| * returns FFmpeg chroma format | |||
| * returns Libav chroma format | |||
| */ | |||
| static enum PixelFormat GetFfmpegChromaFormat(dirac_chroma_t dirac_pix_fmt) | |||
| { | |||
| @@ -103,7 +103,7 @@ static int libdirac_decode_frame(AVCodecContext *avccontext, | |||
| case STATE_SEQUENCE: | |||
| { | |||
| /* tell FFmpeg about sequence details */ | |||
| /* tell Libav about sequence details */ | |||
| dirac_sourceparams_t *src_params = &p_dirac_params->p_decoder->src_params; | |||
| if (av_image_check_size(src_params->width, src_params->height, | |||
| @@ -118,7 +118,7 @@ static SchroBuffer* FfmpegFindNextSchroParseUnit(FfmpegSchroParseUnitContext *pa | |||
| } | |||
| /** | |||
| * Returns FFmpeg chroma format. | |||
| * Returns Libav chroma format. | |||
| */ | |||
| static enum PixelFormat GetFfmpegChromaFormat(SchroChromaFormat schro_pix_fmt) | |||
| { | |||
| @@ -169,7 +169,7 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avccontext) | |||
| p_schro_params->format = schro_decoder_get_video_format(decoder); | |||
| /* Tell FFmpeg about sequence details. */ | |||
| /* Tell Libav about sequence details. */ | |||
| if (av_image_check_size(p_schro_params->format->width, p_schro_params->format->height, | |||
| 0, avccontext) < 0) { | |||
| av_log(avccontext, AV_LOG_ERROR, "invalid dimensions (%dx%d)\n", | |||
| @@ -30,7 +30,7 @@ | |||
| * and o_ prefixes on variables which are libogg types. | |||
| */ | |||
| /* FFmpeg includes */ | |||
| /* Libav includes */ | |||
| #include "libavutil/intreadwrite.h" | |||
| #include "libavutil/log.h" | |||
| #include "libavutil/base64.h" | |||
| @@ -209,7 +209,7 @@ static int vlc_decode_block(MimicContext *ctx, int num_coeffs, int qscale) | |||
| value = get_bits(&ctx->gb, num_bits); | |||
| /* FFmpeg's IDCT behaves somewhat different from the original code, so | |||
| /* Libav's IDCT behaves somewhat different from the original code, so | |||
| * a factor of 4 was added to the input */ | |||
| coeff = vlcdec_lookup[num_bits][value]; | |||
| @@ -26,9 +26,6 @@ | |||
| * http://www.pcisys.net/~melanson/codecs/ | |||
| * | |||
| * The MS RLE decoder outputs PAL8 colorspace data. | |||
| * | |||
| * Note that this decoder expects the palette colors from the end of the | |||
| * BITMAPINFO header passed through palctrl. | |||
| */ | |||
| #include <stdio.h> | |||
| @@ -46,6 +43,7 @@ typedef struct MsrleContext { | |||
| const unsigned char *buf; | |||
| int size; | |||
| uint32_t pal[256]; | |||
| } MsrleContext; | |||
| static av_cold int msrle_decode_init(AVCodecContext *avctx) | |||
| @@ -91,13 +89,16 @@ static int msrle_decode_frame(AVCodecContext *avctx, | |||
| return -1; | |||
| } | |||
| if (s->avctx->palctrl) { | |||
| /* make the palette available */ | |||
| memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (s->avctx->palctrl->palette_changed) { | |||
| if (avctx->bits_per_coded_sample <= 8) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| s->frame.palette_has_changed = 1; | |||
| s->avctx->palctrl->palette_changed = 0; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| /* make the palette available */ | |||
| memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| } | |||
| /* FIXME how to correctly detect RLE ??? */ | |||
| @@ -25,9 +25,6 @@ | |||
| * For more information about the MS Video-1 format, visit: | |||
| * http://www.pcisys.net/~melanson/codecs/ | |||
| * | |||
| * This decoder outputs either PAL8 or RGB555 data, depending on the | |||
| * whether a RGB palette was passed through palctrl; | |||
| * if it's present, then the data is PAL8; RGB555 otherwise. | |||
| */ | |||
| #include <stdio.h> | |||
| @@ -55,6 +52,7 @@ typedef struct Msvideo1Context { | |||
| int mode_8bit; /* if it's not 8-bit, it's 16-bit */ | |||
| uint32_t pal[256]; | |||
| } Msvideo1Context; | |||
| static av_cold int msvideo1_decode_init(AVCodecContext *avctx) | |||
| @@ -64,7 +62,7 @@ static av_cold int msvideo1_decode_init(AVCodecContext *avctx) | |||
| s->avctx = avctx; | |||
| /* figure out the colorspace based on the presence of a palette */ | |||
| if (s->avctx->palctrl) { | |||
| if (s->avctx->bits_per_coded_sample == 8) { | |||
| s->mode_8bit = 1; | |||
| avctx->pix_fmt = PIX_FMT_PAL8; | |||
| } else { | |||
| @@ -173,13 +171,8 @@ static void msvideo1_decode_8bit(Msvideo1Context *s) | |||
| } | |||
| /* make the palette available on the way out */ | |||
| if (s->avctx->pix_fmt == PIX_FMT_PAL8) { | |||
| memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (s->avctx->palctrl->palette_changed) { | |||
| s->frame.palette_has_changed = 1; | |||
| s->avctx->palctrl->palette_changed = 0; | |||
| } | |||
| } | |||
| if (s->avctx->pix_fmt == PIX_FMT_PAL8) | |||
| memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| } | |||
| static void msvideo1_decode_16bit(Msvideo1Context *s) | |||
| @@ -309,6 +302,15 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, | |||
| return -1; | |||
| } | |||
| if (s->mode_8bit) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| s->frame.palette_has_changed = 1; | |||
| } | |||
| } | |||
| if (s->mode_8bit) | |||
| msvideo1_decode_8bit(s); | |||
| else | |||
| @@ -30,6 +30,7 @@ typedef struct QpegContext{ | |||
| AVCodecContext *avctx; | |||
| AVFrame pic; | |||
| uint8_t *refdata; | |||
| uint32_t pal[256]; | |||
| } QpegContext; | |||
| static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size, | |||
| @@ -256,6 +257,7 @@ static int decode_frame(AVCodecContext *avctx, | |||
| AVFrame * const p= (AVFrame*)&a->pic; | |||
| uint8_t* outdata; | |||
| int delta; | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if(p->data[0]) | |||
| avctx->release_buffer(avctx, p); | |||
| @@ -274,11 +276,11 @@ static int decode_frame(AVCodecContext *avctx, | |||
| } | |||
| /* make the palette available on the way out */ | |||
| memcpy(a->pic.data[1], a->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (a->avctx->palctrl->palette_changed) { | |||
| if (pal) { | |||
| a->pic.palette_has_changed = 1; | |||
| a->avctx->palctrl->palette_changed = 0; | |||
| memcpy(a->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE); | |||
| *data_size = sizeof(AVFrame); | |||
| *(AVFrame*)data = a->pic; | |||
| @@ -289,10 +291,6 @@ static int decode_frame(AVCodecContext *avctx, | |||
| static av_cold int decode_init(AVCodecContext *avctx){ | |||
| QpegContext * const a = avctx->priv_data; | |||
| if (!avctx->palctrl) { | |||
| av_log(avctx, AV_LOG_FATAL, "Missing required palette via palctrl\n"); | |||
| return -1; | |||
| } | |||
| a->avctx = avctx; | |||
| avctx->pix_fmt= PIX_FMT_PAL8; | |||
| a->refdata = av_malloc(avctx->width * avctx->height); | |||
| @@ -46,6 +46,7 @@ typedef struct QtrleContext { | |||
| const unsigned char *buf; | |||
| int size; | |||
| uint32_t pal[256]; | |||
| } QtrleContext; | |||
| #define CHECK_STREAM_PTR(n) \ | |||
| @@ -511,12 +512,15 @@ static int qtrle_decode_frame(AVCodecContext *avctx, | |||
| } | |||
| if(has_palette) { | |||
| /* make the palette available on the way out */ | |||
| memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (s->avctx->palctrl->palette_changed) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| s->frame.palette_has_changed = 1; | |||
| s->avctx->palctrl->palette_changed = 0; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| /* make the palette available on the way out */ | |||
| memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| } | |||
| done: | |||
| @@ -158,9 +158,13 @@ static int raw_decode(AVCodecContext *avctx, | |||
| (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){ | |||
| frame->data[1]= context->palette; | |||
| } | |||
| if (avctx->palctrl && avctx->palctrl->palette_changed) { | |||
| memcpy(frame->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| avctx->palctrl->palette_changed = 0; | |||
| if (avctx->pix_fmt == PIX_FMT_PAL8) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| memcpy(frame->data[1], pal, AVPALETTE_SIZE); | |||
| frame->palette_has_changed = 1; | |||
| } | |||
| } | |||
| if(avctx->pix_fmt==PIX_FMT_BGR24 && ((frame->linesize[0]+3)&~3)*avctx->height <= buf_size) | |||
| frame->linesize[0] = (frame->linesize[0]+3)&~3; | |||
| @@ -54,6 +54,7 @@ typedef struct SmcContext { | |||
| unsigned char color_quads[COLORS_PER_TABLE * CQUAD]; | |||
| unsigned char color_octets[COLORS_PER_TABLE * COCTET]; | |||
| uint32_t pal[256]; | |||
| } SmcContext; | |||
| #define GET_BLOCK_COUNT() \ | |||
| @@ -110,11 +111,7 @@ static void smc_decode_stream(SmcContext *s) | |||
| int color_octet_index = 0; | |||
| /* make the palette available */ | |||
| memcpy(s->frame.data[1], s->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (s->avctx->palctrl->palette_changed) { | |||
| s->frame.palette_has_changed = 1; | |||
| s->avctx->palctrl->palette_changed = 0; | |||
| } | |||
| memcpy(s->frame.data[1], s->pal, AVPALETTE_SIZE); | |||
| chunk_size = AV_RB32(&s->buf[stream_ptr]) & 0x00FFFFFF; | |||
| stream_ptr += 4; | |||
| @@ -440,6 +437,7 @@ static int smc_decode_frame(AVCodecContext *avctx, | |||
| const uint8_t *buf = avpkt->data; | |||
| int buf_size = avpkt->size; | |||
| SmcContext *s = avctx->priv_data; | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| s->buf = buf; | |||
| s->size = buf_size; | |||
| @@ -452,6 +450,11 @@ static int smc_decode_frame(AVCodecContext *avctx, | |||
| return -1; | |||
| } | |||
| if (pal) { | |||
| s->frame.palette_has_changed = 1; | |||
| memcpy(s->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| smc_decode_stream(s); | |||
| *data_size = sizeof(AVFrame); | |||
| @@ -171,13 +171,6 @@ static int decode_frame(AVCodecContext *avctx, | |||
| stride = -p->linesize[0]; | |||
| } | |||
| if(avctx->pix_fmt == PIX_FMT_PAL8 && avctx->palctrl){ | |||
| memcpy(p->data[1], avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if(avctx->palctrl->palette_changed){ | |||
| p->palette_has_changed = 1; | |||
| avctx->palctrl->palette_changed = 0; | |||
| } | |||
| } | |||
| if(colors){ | |||
| size_t pal_size; | |||
| if((colors + first_clr) > 256){ | |||
| @@ -64,7 +64,7 @@ typedef struct TM2Context{ | |||
| * Huffman codes for each of streams | |||
| */ | |||
| typedef struct TM2Codes{ | |||
| VLC vlc; ///< table for FFmpeg bitstream reader | |||
| VLC vlc; ///< table for Libav bitstream reader | |||
| int bits; | |||
| int *recode; ///< table for converting from code indexes to values | |||
| int length; | |||
| @@ -60,6 +60,8 @@ typedef struct TsccContext { | |||
| unsigned char* decomp_buf; | |||
| int height; | |||
| z_stream zstream; | |||
| uint32_t pal[256]; | |||
| } CamtasiaContext; | |||
| /* | |||
| @@ -111,11 +113,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac | |||
| /* make the palette available on the way out */ | |||
| if (c->avctx->pix_fmt == PIX_FMT_PAL8) { | |||
| memcpy(c->pic.data[1], c->avctx->palctrl->palette, AVPALETTE_SIZE); | |||
| if (c->avctx->palctrl->palette_changed) { | |||
| const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); | |||
| if (pal) { | |||
| c->pic.palette_has_changed = 1; | |||
| c->avctx->palctrl->palette_changed = 0; | |||
| memcpy(c->pal, pal, AVPALETTE_SIZE); | |||
| } | |||
| memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); | |||
| } | |||
| *data_size = sizeof(AVFrame); | |||
| @@ -1247,7 +1247,7 @@ int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b){ | |||
| void av_log_missing_feature(void *avc, const char *feature, int want_sample) | |||
| { | |||
| av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your FFmpeg " | |||
| av_log(avc, AV_LOG_WARNING, "%s not implemented. Update your Libav " | |||
| "version to the newest one from Git. If the problem still " | |||
| "occurs, it means that your file has a feature which has not " | |||
| "been implemented.", feature); | |||
| @@ -258,7 +258,7 @@ static int start_frame(AVCodecContext *avctx, | |||
| pic_param->seq_fields.bits.delta_pic_order_always_zero_flag = h->sps.delta_pic_order_always_zero_flag; | |||
| pic_param->num_slice_groups_minus1 = h->pps.slice_group_count - 1; | |||
| pic_param->slice_group_map_type = h->pps.mb_slice_group_map_type; | |||
| pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in FFmpeg */ | |||
| pic_param->slice_group_change_rate_minus1 = 0; /* XXX: unimplemented in Libav */ | |||
| pic_param->pic_init_qp_minus26 = h->pps.init_qp - 26; | |||
| pic_param->pic_init_qs_minus26 = h->pps.init_qs - 26; | |||
| pic_param->chroma_qp_index_offset = h->pps.chroma_qp_index_offset[0]; | |||
| @@ -129,7 +129,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer | |||
| /* video_plane_with_short_video_header() contains all GOBs | |||
| * in-order, and this is what VA API (Intel backend) expects: only | |||
| * a single slice param. So fake macroblock_number for FFmpeg so | |||
| * a single slice param. So fake macroblock_number for Libav so | |||
| * that we don't call vaapi_mpeg4_decode_slice() again | |||
| */ | |||
| if (avctx->codec->id == CODEC_ID_H263) | |||
| @@ -24,7 +24,7 @@ | |||
| #include "vc1.h" | |||
| #include "vc1data.h" | |||
| /** Translate FFmpeg MV modes to VA API */ | |||
| /** Translate Libav MV modes to VA API */ | |||
| static int get_VAMvModeVC1(enum MVModes mv_mode) | |||
| { | |||
| switch (mv_mode) { | |||
| @@ -116,7 +116,7 @@ static inline VAMvModeVC1 vc1_get_MVMODE2(VC1Context *v) | |||
| return 0; | |||
| } | |||
| /** Pack FFmpeg bitplanes into a VABitPlaneBuffer element */ | |||
| /** Pack Libav bitplanes into a VABitPlaneBuffer element */ | |||
| static inline void vc1_pack_bitplanes(uint8_t *bitplane, int n, const uint8_t *ff_bp[3], int x, int y, int stride) | |||
| { | |||
| const int bitplane_index = n / 2; | |||
| @@ -218,6 +218,7 @@ typedef struct VC1Context{ | |||
| int range_x, range_y; ///< MV range | |||
| uint8_t pq, altpq; ///< Current/alternate frame quantizer scale | |||
| uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT | |||
| int left_blk_sh, top_blk_sh; ///< Either 3 or 0, positions of l/t in blk[] | |||
| const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode | |||
| const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode | |||
| /** pquant parameters */ | |||
| @@ -1499,16 +1499,16 @@ static int vc1_decode_i_block(VC1Context *v, DCTELEM block[64], int n, int coded | |||
| if(s->ac_pred) { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) | |||
| block[k] += ac_val[k]; | |||
| block[k << v->left_blk_sh] += ac_val[k]; | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) | |||
| block[k << 3] += ac_val[k + 8]; | |||
| block[k << v->top_blk_sh] += ac_val[k + 8]; | |||
| } | |||
| } | |||
| /* save AC coeffs for further prediction */ | |||
| for(k = 1; k < 8; k++) { | |||
| ac_val2[k] = block[k]; | |||
| ac_val2[k + 8] = block[k << 3]; | |||
| ac_val2[k] = block[k << v->left_blk_sh]; | |||
| ac_val2[k + 8] = block[k << v->top_blk_sh]; | |||
| } | |||
| /* scale AC coeffs */ | |||
| @@ -1545,15 +1545,15 @@ not_coded: | |||
| if(s->ac_pred) { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) { | |||
| block[k] = ac_val[k] * scale; | |||
| if(!v->pquantizer && block[k]) | |||
| block[k] += (block[k] < 0) ? -v->pq : v->pq; | |||
| block[k << v->left_blk_sh] = ac_val[k] * scale; | |||
| if(!v->pquantizer && block[k << v->left_blk_sh]) | |||
| block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -v->pq : v->pq; | |||
| } | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) { | |||
| block[k << 3] = ac_val[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << 3]) | |||
| block[k << 3] += (block[k << 3] < 0) ? -v->pq : v->pq; | |||
| block[k << v->top_blk_sh] = ac_val[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << v->top_blk_sh]) | |||
| block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -v->pq : v->pq; | |||
| } | |||
| } | |||
| i = 63; | |||
| @@ -1680,25 +1680,25 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) | |||
| block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) | |||
| block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| } | |||
| } else { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) | |||
| block[k] += ac_val[k]; | |||
| block[k << v->left_blk_sh] += ac_val[k]; | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) | |||
| block[k << 3] += ac_val[k + 8]; | |||
| block[k << v->top_blk_sh] += ac_val[k + 8]; | |||
| } | |||
| } | |||
| } | |||
| /* save AC coeffs for further prediction */ | |||
| for(k = 1; k < 8; k++) { | |||
| ac_val2[k] = block[k]; | |||
| ac_val2[k + 8] = block[k << 3]; | |||
| ac_val2[k ] = block[k << v->left_blk_sh]; | |||
| ac_val2[k + 8] = block[k << v->top_blk_sh]; | |||
| } | |||
| /* scale AC coeffs */ | |||
| @@ -1740,15 +1740,15 @@ static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int c | |||
| if(use_pred) { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) { | |||
| block[k] = ac_val2[k] * scale; | |||
| if(!v->pquantizer && block[k]) | |||
| block[k] += (block[k] < 0) ? -mquant : mquant; | |||
| block[k << v->left_blk_sh] = ac_val2[k] * scale; | |||
| if(!v->pquantizer && block[k << v->left_blk_sh]) | |||
| block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; | |||
| } | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) { | |||
| block[k << 3] = ac_val2[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << 3]) | |||
| block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; | |||
| block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << v->top_blk_sh]) | |||
| block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; | |||
| } | |||
| } | |||
| i = 63; | |||
| @@ -1878,25 +1878,25 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) | |||
| block[k] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| block[k << v->left_blk_sh] += (ac_val[k] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) | |||
| block[k << 3] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| block[k << v->top_blk_sh] += (ac_val[k + 8] * q2 * ff_vc1_dqscale[q1 - 1] + 0x20000) >> 18; | |||
| } | |||
| } else { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) | |||
| block[k] += ac_val[k]; | |||
| block[k << v->left_blk_sh] += ac_val[k]; | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) | |||
| block[k << 3] += ac_val[k + 8]; | |||
| block[k << v->top_blk_sh] += ac_val[k + 8]; | |||
| } | |||
| } | |||
| } | |||
| /* save AC coeffs for further prediction */ | |||
| for(k = 1; k < 8; k++) { | |||
| ac_val2[k] = block[k]; | |||
| ac_val2[k + 8] = block[k << 3]; | |||
| ac_val2[k ] = block[k << v->left_blk_sh]; | |||
| ac_val2[k + 8] = block[k << v->top_blk_sh]; | |||
| } | |||
| /* scale AC coeffs */ | |||
| @@ -1938,15 +1938,15 @@ static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int c | |||
| if(use_pred) { | |||
| if(dc_pred_dir) { //left | |||
| for(k = 1; k < 8; k++) { | |||
| block[k] = ac_val2[k] * scale; | |||
| if(!v->pquantizer && block[k]) | |||
| block[k] += (block[k] < 0) ? -mquant : mquant; | |||
| block[k << v->left_blk_sh] = ac_val2[k] * scale; | |||
| if(!v->pquantizer && block[k << v->left_blk_sh]) | |||
| block[k << v->left_blk_sh] += (block[k << v->left_blk_sh] < 0) ? -mquant : mquant; | |||
| } | |||
| } else { //top | |||
| for(k = 1; k < 8; k++) { | |||
| block[k << 3] = ac_val2[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << 3]) | |||
| block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; | |||
| block[k << v->top_blk_sh] = ac_val2[k + 8] * scale; | |||
| if(!v->pquantizer && block[k << v->top_blk_sh]) | |||
| block[k << v->top_blk_sh] += (block[k << v->top_blk_sh] < 0) ? -mquant : mquant; | |||
| } | |||
| } | |||
| i = 63; | |||
| @@ -3236,13 +3236,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) | |||
| return -1; | |||
| if (vc1_init_common(v) < 0) return -1; | |||
| ff_vc1dsp_init(&v->vc1dsp); | |||
| for (i = 0; i < 64; i++) { | |||
| #define transpose(x) ((x>>3) | ((x&7)<<3)) | |||
| v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); | |||
| v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); | |||
| v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); | |||
| v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); | |||
| } | |||
| avctx->coded_width = avctx->width; | |||
| avctx->coded_height = avctx->height; | |||
| @@ -3326,6 +3319,22 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) | |||
| s->mb_width = (avctx->coded_width+15)>>4; | |||
| s->mb_height = (avctx->coded_height+15)>>4; | |||
| if (v->profile == PROFILE_ADVANCED || v->res_fasttx) { | |||
| for (i = 0; i < 64; i++) { | |||
| #define transpose(x) ((x>>3) | ((x&7)<<3)) | |||
| v->zz_8x8[0][i] = transpose(wmv1_scantable[0][i]); | |||
| v->zz_8x8[1][i] = transpose(wmv1_scantable[1][i]); | |||
| v->zz_8x8[2][i] = transpose(wmv1_scantable[2][i]); | |||
| v->zz_8x8[3][i] = transpose(wmv1_scantable[3][i]); | |||
| } | |||
| v->left_blk_sh = 0; | |||
| v->top_blk_sh = 3; | |||
| } else { | |||
| memcpy(v->zz_8x8, wmv1_scantable, 4*64); | |||
| v->left_blk_sh = 3; | |||
| v->top_blk_sh = 0; | |||
| } | |||
| /* Allocate mb bitplanes */ | |||
| v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height); | |||
| v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height); | |||
| @@ -1,19 +1,19 @@ | |||
| /* | |||
| * | |||
| * This file is part of FFmpeg. | |||
| * This file is part of Libav. | |||
| * | |||
| * FFmpeg is free software; you can redistribute it and/or | |||
| * Libav 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.1 of the License, or (at your option) any later version. | |||
| * | |||
| * FFmpeg is distributed in the hope that it will be useful, | |||
| * Libav 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 FFmpeg; if not, write to the Free Software | |||
| * License along with Libav; if not, write to the Free Software | |||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| */ | |||
| @@ -21,8 +21,8 @@ | |||
| #define AVCODEC_VERSION_H | |||
| #define LIBAVCODEC_VERSION_MAJOR 52 | |||
| #define LIBAVCODEC_VERSION_MINOR 119 | |||
| #define LIBAVCODEC_VERSION_MICRO 1 | |||
| #define LIBAVCODEC_VERSION_MINOR 120 | |||
| #define LIBAVCODEC_VERSION_MICRO 0 | |||
| #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | |||
| LIBAVCODEC_VERSION_MINOR, \ | |||
| @@ -957,7 +957,7 @@ static av_cold int vorbis_encode_init(AVCodecContext *avccontext) | |||
| vorbis_enc_context *venc = avccontext->priv_data; | |||
| if (avccontext->channels != 2) { | |||
| av_log(avccontext, AV_LOG_ERROR, "Current FFmpeg Vorbis encoder only supports 2 channels.\n"); | |||
| av_log(avccontext, AV_LOG_ERROR, "Current Libav Vorbis encoder only supports 2 channels.\n"); | |||
| return -1; | |||
| } | |||
| @@ -1912,7 +1912,7 @@ static int wmavoice_decode_packet(AVCodecContext *ctx, void *data, | |||
| *data_size = 0; | |||
| /* Packets are sometimes a multiple of ctx->block_align, with a packet | |||
| * header at each ctx->block_align bytes. However, FFmpeg's ASF demuxer | |||
| * header at each ctx->block_align bytes. However, Libav's ASF demuxer | |||
| * feeds us ASF packets, which may concatenate multiple "codec" packets | |||
| * in a single "muxer" packet, so we artificially emulate that by | |||
| * capping the packet size at ctx->block_align. */ | |||
| @@ -2,20 +2,20 @@ | |||
| * Copyright (c) 2010 Brandon Mintern | |||
| * Copyright (c) 2007 Bobby Bingham | |||
| * | |||
| * This file is part of FFmpeg. | |||
| * This file is part of Libav. | |||
| * | |||
| * FFmpeg is free software; you can redistribute it and/or | |||
| * Libav 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.1 of the License, or (at your option) any later version. | |||
| * | |||
| * FFmpeg is distributed in the hope that it will be useful, | |||
| * Libav 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 FFmpeg; if not, write to the Free Software | |||
| * License along with Libav; if not, write to the Free Software | |||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
| */ | |||
| @@ -45,6 +45,8 @@ typedef struct { | |||
| uint16_t stream_language_index; | |||
| int palette_changed; | |||
| uint32_t palette[256]; | |||
| } ASFStream; | |||
| typedef struct { | |||
| @@ -357,15 +357,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) | |||
| /* This is true for all paletted codecs implemented in ffmpeg */ | |||
| if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { | |||
| int av_unused i; | |||
| st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); | |||
| #if HAVE_BIGENDIAN | |||
| for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) | |||
| st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); | |||
| asf_st->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); | |||
| #else | |||
| memcpy(st->codec->palctrl->palette, st->codec->extradata, | |||
| FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); | |||
| memcpy(asf_st->palette, st->codec->extradata, | |||
| FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); | |||
| #endif | |||
| st->codec->palctrl->palette_changed = 1; | |||
| asf_st->palette_changed = 1; | |||
| } | |||
| st->codec->codec_tag = tag1; | |||
| @@ -958,6 +957,17 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk | |||
| asf_st->pkt.stream_index = asf->stream_index; | |||
| asf_st->pkt.pos = | |||
| asf_st->packet_pos= asf->packet_pos; | |||
| if (asf_st->pkt.data && asf_st->palette_changed) { | |||
| uint8_t *pal; | |||
| pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, | |||
| AVPALETTE_SIZE); | |||
| if (!pal) { | |||
| av_log(s, AV_LOG_ERROR, "Cannot append palette to packet\n"); | |||
| } else { | |||
| memcpy(pal, asf_st->palette, AVPALETTE_SIZE); | |||
| asf_st->palette_changed = 0; | |||
| } | |||
| } | |||
| //printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", | |||
| //asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & AV_PKT_FLAG_KEY, | |||
| //s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, asf->packet_obj_size); | |||
| @@ -1119,7 +1129,6 @@ static int asf_read_close(AVFormatContext *s) | |||
| asf_reset_header(s); | |||
| for(i=0;i<s->nb_streams;i++) { | |||
| AVStream *st = s->streams[i]; | |||
| av_free(st->codec->palctrl); | |||
| } | |||
| return 0; | |||
| } | |||
| @@ -750,7 +750,7 @@ typedef struct AVFormatContext { | |||
| /** | |||
| * Decoding: total stream bitrate in bit/s, 0 if not | |||
| * available. Never set it directly if the file_size and the | |||
| * duration are known as FFmpeg can compute it automatically. | |||
| * duration are known as Libav can compute it automatically. | |||
| */ | |||
| int bit_rate; | |||
| @@ -588,17 +588,16 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) | |||
| /* Extract palette from extradata if bpp <= 8. */ | |||
| /* This code assumes that extradata contains only palette. */ | |||
| /* This is true for all paletted codecs implemented in FFmpeg. */ | |||
| /* This is true for all paletted codecs implemented in Libav. */ | |||
| if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { | |||
| st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); | |||
| #if HAVE_BIGENDIAN | |||
| for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) | |||
| st->codec->palctrl->palette[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); | |||
| ast->pal[i] = av_bswap32(((uint32_t*)st->codec->extradata)[i]); | |||
| #else | |||
| memcpy(st->codec->palctrl->palette, st->codec->extradata, | |||
| memcpy(ast->pal, st->codec->extradata, | |||
| FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); | |||
| #endif | |||
| st->codec->palctrl->palette_changed = 1; | |||
| ast->has_pal = 1; | |||
| } | |||
| print_tag("video", tag1, 0); | |||
| @@ -932,14 +931,14 @@ resync: | |||
| return err; | |||
| if(ast->has_pal && pkt->data && pkt->size<(unsigned)INT_MAX/2){ | |||
| void *ptr= av_realloc(pkt->data, pkt->size + 4*256 + FF_INPUT_BUFFER_PADDING_SIZE); | |||
| if(ptr){ | |||
| ast->has_pal=0; | |||
| pkt->size += 4*256; | |||
| pkt->data= ptr; | |||
| memcpy(pkt->data + pkt->size - 4*256, ast->pal, 4*256); | |||
| }else | |||
| av_log(s, AV_LOG_ERROR, "Failed to append palette\n"); | |||
| uint8_t *pal; | |||
| pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); | |||
| if(!pal){ | |||
| av_log(s, AV_LOG_ERROR, "Failed to allocate data for palette\n"); | |||
| }else{ | |||
| memcpy(pal, ast->pal, AVPALETTE_SIZE); | |||
| ast->has_pal = 0; | |||
| } | |||
| } | |||
| if (CONFIG_DV_DEMUXER && avi->dv_demux) { | |||
| @@ -1340,7 +1339,6 @@ static int avi_read_close(AVFormatContext *s) | |||
| for(i=0;i<s->nb_streams;i++) { | |||
| AVStream *st = s->streams[i]; | |||
| AVIStream *ast = st->priv_data; | |||
| av_free(st->codec->palctrl); | |||
| if (ast) { | |||
| if (ast->sub_ctx) { | |||
| av_freep(&ast->sub_ctx->pb); | |||
| @@ -86,8 +86,6 @@ typedef struct IdcinDemuxContext { | |||
| int audio_present; | |||
| int64_t pts; | |||
| AVPaletteControl palctrl; | |||
| } IdcinDemuxContext; | |||
| static int idcin_probe(AVProbeData *p) | |||
| @@ -172,8 +170,6 @@ static int idcin_read_header(AVFormatContext *s, | |||
| if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) != | |||
| HUFFMAN_TABLE_SIZE) | |||
| return AVERROR(EIO); | |||
| /* save a reference in order to transport the palette */ | |||
| st->codec->palctrl = &idcin->palctrl; | |||
| /* if sample rate is 0, assume no audio */ | |||
| if (sample_rate) { | |||
| @@ -226,6 +222,7 @@ static int idcin_read_packet(AVFormatContext *s, | |||
| int palette_scale; | |||
| unsigned char r, g, b; | |||
| unsigned char palette_buffer[768]; | |||
| uint32_t palette[256]; | |||
| if (url_feof(s->pb)) | |||
| return AVERROR(EIO); | |||
| @@ -236,7 +233,6 @@ static int idcin_read_packet(AVFormatContext *s, | |||
| return AVERROR(EIO); | |||
| } else if (command == 1) { | |||
| /* trigger a palette change */ | |||
| idcin->palctrl.palette_changed = 1; | |||
| if (avio_read(pb, palette_buffer, 768) != 768) | |||
| return AVERROR(EIO); | |||
| /* scale the palette as necessary */ | |||
| @@ -251,7 +247,7 @@ static int idcin_read_packet(AVFormatContext *s, | |||
| r = palette_buffer[i * 3 ] << palette_scale; | |||
| g = palette_buffer[i * 3 + 1] << palette_scale; | |||
| b = palette_buffer[i * 3 + 2] << palette_scale; | |||
| idcin->palctrl.palette[i] = (r << 16) | (g << 8) | (b); | |||
| palette[i] = (r << 16) | (g << 8) | (b); | |||
| } | |||
| } | |||
| @@ -262,6 +258,15 @@ static int idcin_read_packet(AVFormatContext *s, | |||
| ret= av_get_packet(pb, pkt, chunk_size); | |||
| if (ret < 0) | |||
| return ret; | |||
| if (command == 1) { | |||
| uint8_t *pal; | |||
| pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, | |||
| AVPALETTE_SIZE); | |||
| if (ret < 0) | |||
| return ret; | |||
| memcpy(pal, palette, AVPALETTE_SIZE); | |||
| } | |||
| pkt->stream_index = idcin->video_stream_index; | |||
| pkt->pts = idcin->pts; | |||
| } else { | |||
| @@ -97,6 +97,8 @@ typedef struct IPMVEContext { | |||
| unsigned int video_width; | |||
| unsigned int video_height; | |||
| int64_t video_pts; | |||
| uint32_t palette[256]; | |||
| int has_palette; | |||
| unsigned int audio_bits; | |||
| unsigned int audio_channels; | |||
| @@ -116,8 +118,6 @@ typedef struct IPMVEContext { | |||
| int64_t next_chunk_offset; | |||
| AVPaletteControl palette_control; | |||
| } IPMVEContext; | |||
| static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, | |||
| @@ -162,6 +162,17 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, | |||
| if (av_new_packet(pkt, s->decode_map_chunk_size + s->video_chunk_size)) | |||
| return CHUNK_NOMEM; | |||
| if (s->has_palette) { | |||
| uint8_t *pal; | |||
| pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, | |||
| AVPALETTE_SIZE); | |||
| if (pal) { | |||
| memcpy(pal, s->palette, AVPALETTE_SIZE); | |||
| s->has_palette = 0; | |||
| } | |||
| } | |||
| pkt->pos= s->decode_map_chunk_offset; | |||
| avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); | |||
| s->decode_map_chunk_offset = 0; | |||
| @@ -456,10 +467,9 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, | |||
| r = scratch[j++] * 4; | |||
| g = scratch[j++] * 4; | |||
| b = scratch[j++] * 4; | |||
| s->palette_control.palette[i] = (r << 16) | (g << 8) | (b); | |||
| s->palette[i] = (r << 16) | (g << 8) | (b); | |||
| } | |||
| /* indicate a palette change */ | |||
| s->palette_control.palette_changed = 1; | |||
| s->has_palette = 1; | |||
| break; | |||
| case OPCODE_SET_PALETTE_COMPRESSED: | |||
| @@ -573,9 +583,6 @@ static int ipmovie_read_header(AVFormatContext *s, | |||
| st->codec->height = ipmovie->video_height; | |||
| st->codec->bits_per_coded_sample = ipmovie->video_bpp; | |||
| /* palette considerations */ | |||
| st->codec->palctrl = &ipmovie->palette_control; | |||
| if (ipmovie->audio_type) { | |||
| st = av_new_stream(s, 0); | |||
| if (!st) | |||
| @@ -123,6 +123,8 @@ typedef struct MOVStreamContext { | |||
| int width; ///< tkhd width | |||
| int height; ///< tkhd height | |||
| int dts_shift; ///< dts shift when ctts is negative | |||
| uint32_t palette[256]; | |||
| int has_palette; | |||
| } MOVStreamContext; | |||
| typedef struct MOVContext { | |||
| @@ -1027,7 +1027,6 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) | |||
| unsigned int color_start, color_count, color_end; | |||
| unsigned char r, g, b; | |||
| st->codec->palctrl = av_malloc(sizeof(*st->codec->palctrl)); | |||
| if (color_greyscale) { | |||
| int color_index, color_dec; | |||
| /* compute the greyscale palette */ | |||
| @@ -1037,7 +1036,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) | |||
| color_dec = 256 / (color_count - 1); | |||
| for (j = 0; j < color_count; j++) { | |||
| r = g = b = color_index; | |||
| st->codec->palctrl->palette[j] = | |||
| sc->palette[j] = | |||
| (r << 16) | (g << 8) | (b); | |||
| color_index -= color_dec; | |||
| if (color_index < 0) | |||
| @@ -1058,7 +1057,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) | |||
| r = color_table[j * 3 + 0]; | |||
| g = color_table[j * 3 + 1]; | |||
| b = color_table[j * 3 + 2]; | |||
| st->codec->palctrl->palette[j] = | |||
| sc->palette[j] = | |||
| (r << 16) | (g << 8) | (b); | |||
| } | |||
| } else { | |||
| @@ -1080,12 +1079,12 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) | |||
| avio_r8(pb); | |||
| b = avio_r8(pb); | |||
| avio_r8(pb); | |||
| st->codec->palctrl->palette[j] = | |||
| sc->palette[j] = | |||
| (r << 16) | (g << 8) | (b); | |||
| } | |||
| } | |||
| } | |||
| st->codec->palctrl->palette_changed = 1; | |||
| sc->has_palette = 1; | |||
| } | |||
| } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { | |||
| int bits_per_sample, flags; | |||
| @@ -2433,6 +2432,17 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) | |||
| ret = av_get_packet(sc->pb, pkt, sample->size); | |||
| if (ret < 0) | |||
| return ret; | |||
| if (sc->has_palette) { | |||
| uint8_t *pal; | |||
| pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); | |||
| if (!pal) { | |||
| av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n"); | |||
| } else { | |||
| memcpy(pal, sc->palette, AVPALETTE_SIZE); | |||
| sc->has_palette = 0; | |||
| } | |||
| } | |||
| #if CONFIG_DV_DEMUXER | |||
| if (mov->dv_demux && sc->dv_audio_container) { | |||
| dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size); | |||
| @@ -181,7 +181,7 @@ static int mpegts_write_section1(MpegTSSection *s, int tid, int id, | |||
| /*********************************************/ | |||
| /* mpegts writer */ | |||
| #define DEFAULT_PROVIDER_NAME "FFmpeg" | |||
| #define DEFAULT_PROVIDER_NAME "Libav" | |||
| #define DEFAULT_SERVICE_NAME "Service01" | |||
| /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ | |||
| @@ -499,7 +499,7 @@ static void mxf_write_identification(AVFormatContext *s) | |||
| { | |||
| MXFContext *mxf = s->priv_data; | |||
| AVIOContext *pb = s->pb; | |||
| const char *company = "FFmpeg"; | |||
| const char *company = "Libav"; | |||
| const char *product = "OP1a Muxer"; | |||
| const char *version; | |||
| int length; | |||
| @@ -59,7 +59,7 @@ static int speex_header(AVFormatContext *s, int idx) { | |||
| st->codec->channels = AV_RL32(p + 48); | |||
| /* We treat the whole Speex packet as a single frame everywhere Speex | |||
| is handled in FFmpeg. This avoids the complexities of splitting | |||
| is handled in Libav. This avoids the complexities of splitting | |||
| and joining individual Speex frames, which are not always | |||
| byte-aligned. */ | |||
| st->codec->frame_size = AV_RL32(p + 56); | |||
| @@ -28,7 +28,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size) | |||
| case AVERROR_EOF: errstr = "End of file"; break; | |||
| case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; | |||
| case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; | |||
| case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; | |||
| case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in Libav, patches welcome"; break; | |||
| case AVERROR_DEMUXER_NOT_FOUND: errstr = "Demuxer not found"; break; | |||
| case AVERROR_MUXER_NOT_FOUND: errstr = "Muxer not found"; break; | |||
| case AVERROR_DECODER_NOT_FOUND: errstr = "Decoder not found"; break; | |||
| @@ -50,7 +50,7 @@ | |||
| #define AVERROR_EOF AVERROR(EPIPE) ///< End of file | |||
| #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in FFmpeg, patches welcome | |||
| #define AVERROR_PATCHWELCOME (-MKTAG('P','A','W','E')) ///< Not yet implemented in Libav, patches welcome | |||
| #if LIBAVUTIL_VERSION_MAJOR > 50 | |||
| #define AVERROR_INVALIDDATA (-MKTAG('I','N','D','A')) ///< Invalid data found when processing input | |||
| @@ -1,6 +1,6 @@ | |||
| 785e38ddd2466046f30aa36399b8f8fa *./tests/data/lavf/lavf.mxf | |||
| 6e9bd63c5cadd7550ad313553ebf665f *./tests/data/lavf/lavf.mxf | |||
| 525881 ./tests/data/lavf/lavf.mxf | |||
| ./tests/data/lavf/lavf.mxf CRC=0x4ace0849 | |||
| b3174e2db508564c1cce0b5e3c1bc1bd *./tests/data/lavf/lavf.mxf_d10 | |||
| e7168856f2b54c6272685967e707fb21 *./tests/data/lavf/lavf.mxf_d10 | |||
| 5330989 ./tests/data/lavf/lavf.mxf_d10 | |||
| ./tests/data/lavf/lavf.mxf_d10 CRC=0xc3f4f92e | |||
| @@ -1,3 +1,3 @@ | |||
| e8d609b8a5b5854a4485718434b287f7 *./tests/data/lavf/lavf.ts | |||
| 1cebaf8b13700a3360e0c32551e36646 *./tests/data/lavf/lavf.ts | |||
| 406644 ./tests/data/lavf/lavf.ts | |||
| ./tests/data/lavf/lavf.ts CRC=0x133216c1 | |||
| @@ -16,7 +16,7 @@ echo patCHeck 1e10.0 | |||
| echo This tool is intended to help a human check/review patches it is very far from | |||
| echo being free of false positives and negatives, its output are just hints of what | |||
| echo may or may not be bad. When you use it and it misses something or detects | |||
| echo something wrong, fix it and send a patch to the ffmpeg-dev ML | |||
| echo something wrong, fix it and send a patch to the libav-devel mailing list. | |||
| echo License:GPL Autor: Michael Niedermayer | |||
| ERE_PRITYP='(unsigned *|)(char|short|long|int|long *int|short *int|void|float|double|(u|)int(8|16|32|64)_t)' | |||