Jamie Foxx was left in awe of Quentin Tarantino after the director rewrote the ending to Django Unchained in the middle of shooting the final scene.

The actor was filming the climax of the upcoming western with co-star Samuel L. Jackson when the filmmaker announced he wasn't happy with how the movie was panning out.

Foxx reveals Tarantino went away to rethink the script and came back moments later with a completely different idea for his grand finale.

He tells About.com, "On the spur of the moment, he rewrote the end of the movie. Blows up the house and says, 'My ending doesn't work.' We're like, 'Well, what are you going to do?' He says, 'Give me a second.' He's walking on the rubble (and says), 'Ok, I got it.' Goes to his trailer, and comes back with the end of the movie, but dope (good).

"Like nobody does that. When a writer writes a movie, he goes and gets a cabin and is there for, like, nine months and comes down with the tablets. This dude just went in his trailer... He's riffing, but he's riffing as a genius would, like Mozart."

The Oscar winner is convinced fans will love the movie's climax, adding, "I don't want to cuss, but damn, it was crazy!... He's a God-gifted person, because he went away, he did something, you could tell that it was troubling him, and when he got it, he came back like, 'I got this motherf**ker now'. And it was just amazing... I don't want to give it away, but it's classic."