OLD | NEW |
1 /* | 1 /* |
2 * H.264 HW decode acceleration through VA API | 2 * H.264 HW decode acceleration through VA API |
3 * | 3 * |
4 * Copyright (C) 2008-2009 Splitted-Desktop Systems | 4 * Copyright (C) 2008-2009 Splitted-Desktop Systems |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 { | 191 { |
192 unsigned int i, j; | 192 unsigned int i, j; |
193 | 193 |
194 *luma_weight_flag = h->luma_weight_flag[list]; | 194 *luma_weight_flag = h->luma_weight_flag[list]; |
195 *chroma_weight_flag = h->chroma_weight_flag[list]; | 195 *chroma_weight_flag = h->chroma_weight_flag[list]; |
196 | 196 |
197 for (i = 0; i < h->ref_count[list]; i++) { | 197 for (i = 0; i < h->ref_count[list]; i++) { |
198 /* VA API also wants the inferred (default) values, not | 198 /* VA API also wants the inferred (default) values, not |
199 only what is available in the bitstream (7.4.3.2). */ | 199 only what is available in the bitstream (7.4.3.2). */ |
200 if (h->luma_weight_flag[list]) { | 200 if (h->luma_weight_flag[list]) { |
201 luma_weight[i] = h->luma_weight[list][i]; | 201 luma_weight[i] = h->luma_weight[i][list][0]; |
202 luma_offset[i] = h->luma_offset[list][i]; | 202 luma_offset[i] = h->luma_weight[i][list][1]; |
203 } else { | 203 } else { |
204 luma_weight[i] = 1 << h->luma_log2_weight_denom; | 204 luma_weight[i] = 1 << h->luma_log2_weight_denom; |
205 luma_offset[i] = 0; | 205 luma_offset[i] = 0; |
206 } | 206 } |
207 for (j = 0; j < 2; j++) { | 207 for (j = 0; j < 2; j++) { |
208 if (h->chroma_weight_flag[list]) { | 208 if (h->chroma_weight_flag[list]) { |
209 chroma_weight[i][j] = h->chroma_weight[list][i][j]; | 209 chroma_weight[i][j] = h->chroma_weight[i][list][j][0]; |
210 chroma_offset[i][j] = h->chroma_offset[list][i][j]; | 210 chroma_offset[i][j] = h->chroma_weight[i][list][j][1]; |
211 } else { | 211 } else { |
212 chroma_weight[i][j] = 1 << h->chroma_log2_weight_denom; | 212 chroma_weight[i][j] = 1 << h->chroma_log2_weight_denom; |
213 chroma_offset[i][j] = 0; | 213 chroma_offset[i][j] = 0; |
214 } | 214 } |
215 } | 215 } |
216 } | 216 } |
217 } | 217 } |
218 | 218 |
219 /** Initializes and starts decoding a frame with VA API. */ | 219 /** Initializes and starts decoding a frame with VA API. */ |
220 static int start_frame(AVCodecContext *avctx, | 220 static int start_frame(AVCodecContext *avctx, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 .name = "h264_vaapi", | 338 .name = "h264_vaapi", |
339 .type = CODEC_TYPE_VIDEO, | 339 .type = CODEC_TYPE_VIDEO, |
340 .id = CODEC_ID_H264, | 340 .id = CODEC_ID_H264, |
341 .pix_fmt = PIX_FMT_VAAPI_VLD, | 341 .pix_fmt = PIX_FMT_VAAPI_VLD, |
342 .capabilities = 0, | 342 .capabilities = 0, |
343 .start_frame = start_frame, | 343 .start_frame = start_frame, |
344 .end_frame = end_frame, | 344 .end_frame = end_frame, |
345 .decode_slice = decode_slice, | 345 .decode_slice = decode_slice, |
346 .priv_data_size = 0, | 346 .priv_data_size = 0, |
347 }; | 347 }; |
OLD | NEW |